Free course English + हिंदी

GATE Computer Science and IT (CS) courseThe official syllabus, line by line, with the chapters that teach it

Pick any line of the GATE Computer Science and IT (CS) syllabus and open the chapters under it. Each chapter starts from the basics and climbs to exam level, with practice questions at the end.

How complete is this course?

✓ Ready to study
100%
First stage (prelims or written) covered
100%
Syllabus lines with chapters (17 of 17)
76official papers in our PYQ bank, 2026–2026
777PYQs placed under their module

What GATE Computer Science and IT (CS) asks most

777 questions · 2019–2026

From 777 past GATE Computer Science and IT (CS) questions. Start where the bars are longest.

Computer Science and IT 72%Aptitude (CSAT) 11%Engineering Mathematics 8%Electronics and Communication Engineering 5%English 4%

  1. 1Operating systems65 Q · 8%📘 Computer Science and IT · start →
  2. 2Computer networks60 Q · 8%📘 Computer Science and IT · start →
  3. 3Theory of computation58 Q · 7%📘 Computer Science and IT · start →
  4. 4Databases58 Q · 7%📘 Computer Science and IT · start →
  5. 5Algorithms55 Q · 7%📘 Computer Science and IT · start →
  6. 6Discrete mathematics54 Q · 7%📘 Computer Science and IT · start →
  7. 7Computer organisation and architecture54 Q · 7%📘 Computer Science and IT · start →
  8. 8Compiler design50 Q · 6%📘 Computer Science and IT · start →
  9. 9Data structures47 Q · 6%📘 Computer Science and IT · start →
  10. 10Algebra and calculus for engineers38 Q · 5%📘 Engineering Mathematics · start →

GATE Computer Science and IT (CS) study plan

32 modules · 137 chapter · ~31 h

Go subject by subject, top to bottom: foundations first, current-affairs-heavy topics last. Tap a subject to see its modules.

Engineering Mathematics2 modules3 ch33 min62 PYQ
  1. 01Algebra and calculus for engineers2 ch · 23 min38 PYQ
    1. Linear algebra: matrices, equations and eigenvalues 12′
    2. Calculus: limits, derivatives, integrals and series 11′
    See the 38 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      For n>1n > 1, the maximum multiplicity of any eigenvalue of an n×nn \times n matrix with elements from R\mathbb{R} is

      1. (a) nn
      2. (b) n−1n - 1
      3. (c) 11
      4. (d) n+1n + 1
      Show answer

      (a) nn

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Let n>1n > 1. Consider an n×nn \times n matrix MM with its elements from R\mathbb{R}. Let the vector (0,1,0,0,…,0)∈Rn(0, 1, 0, 0, \ldots, 0) \in \mathbb{R}^n be in the null space of MM.

      Which of the following options is/are always correct?

      1. (a) Determinant of MM is 1
      2. (b) Determinant of MM is 0
      3. (c) Rank of MM is 1
      4. (d) There are at least two non-zero vectors in the null space of MM
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      For a real number aa, let I(a)=∫−11(3x2−ax+1) dxI(a) = \int_{-1}^{1} (3x^2 - ax + 1)\, dx. Which of the following statements is/are true?

      1. (a) The value of I(a)I(a) is independent of the value of aa
      2. (b) The value of I(a)I(a) can vary with the value of aa
      3. (c) There exists a∈(−∞,+∞)a \in (-\infty, +\infty) such that I(a)I(a) is a positive real number
      4. (d) There exists a∈(−∞,+∞)a \in (-\infty, +\infty) such that I(a)I(a) is a negative real number
      Show answer

      ()

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      Consider the system of linear equations given below.



      ax+y=bax + y = b





      16x+ay=2416x + ay = 24




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

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the function f:R→Rf: \mathbb{R} \to \mathbb{R} defined as follows:



      f(x)={c1ex−c2log⁡e(1x),if x>03otherwisef(x) = \begin{cases} c_1 e^{x} - c_2 \log_{e}\left(\frac{1}{x}\right), & \text{if } x > 0 \\ 3 & \text{otherwise} \end{cases}




      where c1,c2∈Rc_1, c_2 \in \mathbb{R}.

      If ff is continuous at x=0x = 0, then c1+c2c_1 + c_2 = _________. (*answer in integer*)

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let f:R→Rf: \mathbb{R} \to \mathbb{R} be defined as follows:



      f(x)=(∣x∣2−x)(x−∣x∣2)f(x) = \left(\frac{\lvert x \rvert}{2} - x\right)\left(x - \frac{\lvert x \rvert}{2}\right)




      Which of the following statements is/are true?

      1. (a) ff has a local maximum
      2. (b) ff has a local minimum
      3. (c) f′f' is continuous over R\mathbb{R}
      4. (d) f′f' is not differentiable over R\mathbb{R}
      Show answer

      ()

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      The determinant of a 4×44 \times 4 matrix A is 3. The value of the determinant of 2A is ____________. (answer in integer)

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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) at which ff is discontinuous is ___________. (answer in integer)

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      If A=(122−1)A = \begin{pmatrix} 1 & 2 \\ 2 & -1 \end{pmatrix}, then which ONE of the following is A8A^{8} ?

      1. (a) (250025)\begin{pmatrix} 25 & 0 \\ 0 & 25 \end{pmatrix}
      2. (b) (12500125)\begin{pmatrix} 125 & 0 \\ 0 & 125 \end{pmatrix}
      3. (c) (62500625)\begin{pmatrix} 625 & 0 \\ 0 & 625 \end{pmatrix}
      4. (d) (3125003125)\begin{pmatrix} 3125 & 0 \\ 0 & 3125 \end{pmatrix}
      Show answer

      (c) (62500625)\begin{pmatrix} 625 & 0 \\ 0 & 625 \end{pmatrix}

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      The value of xx such that x>1x > 1, satisfying the equation ∫1xtln⁡t dt=14\int_{1}^{x} t \ln t \, dt = \dfrac{1}{4} is

      1. (a) e\sqrt{e}
      2. (b) ee
      3. (c) e2e^{2}
      4. (d) e−1e - 1
      Show answer

      (a) e\sqrt{e}

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let LL, MM, and NN be non-singular matrices of order 3 satisfying the equations

      L2=L−1L^{2} = L^{-1}, M=L8M = L^{8} and N=L2N = L^{2}.

      Which ONE of the following is the value of the determinant of (M−N)(M - N)?

      1. (a) 0
      2. (b) 1
      3. (c) 2
      4. (d) 3
      Show answer

      (a) 0

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the given system of linear equations for variables xx and yy, where kk is a real-valued constant. Which of the following option(s) is/are CORRECT?



      x+ky=1x + ky = 1





      kx+y=−1kx + y = -1


      1. (a) There is exactly one value of kk for which the above system of equations has no solution.
      2. (b) There exist an infinite number of values of kk for which the system of equations has no solution.
      3. (c) There exists exactly one value of kk for which the system of equations has exactly one solution.
      4. (d) There exists exactly one value of kk for which the system of equations has an infinite number of solutions.
      Show answer

      ()

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the given function f(x)f(x).



      f(x)={ax+bfor x<1x3+x2+1for x≥1f(x) = \begin{cases} ax + b & \text{for } x < 1 \\ x^3 + x^2 + 1 & \text{for } x \ge 1 \end{cases}




      If the function is differentiable everywhere, the value of bb must be ________. (rounded off to one decimal place)

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let AA be a 2×22 \times 2 matrix as given.



      A=[111−1]A = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}




      What are the eigenvalues of the matrix A13A^{13}?

      1. (a) 1,−11, -1
      2. (b) 22,−222\sqrt{2}, -2\sqrt{2}
      3. (c) 42,−424\sqrt{2}, -4\sqrt{2}
      4. (d) 642,−64264\sqrt{2}, -64\sqrt{2}
      Show answer

      (d) 642,−64264\sqrt{2}, -64\sqrt{2}

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a system of linear equations PX=QPX = Q where P∈R3×3P \in \mathbb{R}^{3\times 3} and Q∈R3×1Q \in \mathbb{R}^{3\times 1}. Suppose PP has an LU decomposition, P=LUP = LU, where



      L=[100l2110l31l321] and U=[u11u12u130u22u2300u33].L = \begin{bmatrix} 1 & 0 & 0 \\ l_{21} & 1 & 0 \\ l_{31} & l_{32} & 1 \end{bmatrix} \text{ and } U = \begin{bmatrix} u_{11} & u_{12} & u_{13} \\ 0 & u_{22} & u_{23} \\ 0 & 0 & u_{33} \end{bmatrix}.




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

      1. (a) The system PX=QPX = Q can be solved by first solving LY=QLY = Q and then UX=YUX = Y.
      2. (b) If PP is invertible, then both LL and UU are invertible.
      3. (c) If PP is singular, then at least one of the diagonal elements of UU is zero.
      4. (d) If PP is symmetric, then both LL and UU are symmetric.
      Show answer

      ()

    16. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let f:R→Rf:\mathbb{R} \to \mathbb{R} be a function such that f(x)=max⁡{x,x3}f(x) = \max\{x, x^3\}, x∈Rx \in \mathbb{R}, where R\mathbb{R} is the set of all real numbers. The set of all points where f(x)f(x) is NOT differentiable is

      1. (a) {−1,1,2}\{-1, 1, 2\}
      2. (b) {−2,−1,1}\{-2, -1, 1\}
      3. (c) {0,1}\{0, 1\}
      4. (d) {−1,0,1}\{-1, 0, 1\}
      Show answer

      (d) {−1,0,1}\{-1, 0, 1\}

    17. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The product of all eigenvalues of the matrix [123456789]\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} is

      1. (a) −1-1
      2. (b) 00
      3. (c) 11
      4. (d) 22
      Show answer

      (b) 00

    18. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let f(x)f(x) be a continuous function from R\mathbb{R} to R\mathbb{R} such that



      f(x)=1−f(2−x)f(x) = 1 - f(2 - x)




      Which one of the following options is the CORRECT value of ∫02f(x) dx\int_0^2 f(x)\,dx ?

      1. (a) 0
      2. (b) 1
      3. (c) 2
      4. (d) −1-1
      Show answer

      (b) 1

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let AA be an n×nn \times n matrix over the set of all real numbers R\mathbb{R}. Let BB be a matrix obtained from AA by swapping two rows. Which of the following statements is/are TRUE?

      1. (a) The determinant of BB is the negative of the determinant of AA
      2. (b) If AA is invertible, then BB is also invertible
      3. (c) If AA is symmetric, then BB is also symmetric
      4. (d) If the trace of AA is zero, then the trace of BB is also zero
      Show answer

      ()

    20. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let AA be any n×mn \times m matrix, where m>nm > n. Which of the following statements is/are TRUE about the system of linear equations Ax=0Ax = \mathbf{0} ?

      1. (a) There exist at least m−nm - n linearly independent solutions to this system
      2. (b) There exist m−nm - n linearly independent vectors such that every solution is a linear combination of these vectors
      3. (c) There exists a non-zero solution in which at least m−nm - n variables are 0
      4. (d) There exists a solution in which at least nn variables are non-zero
      Show answer

      (a) There exist at least m−nm - n linearly independent solutions to this system

    21. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let


      A=[1234412334122341]A = \begin{bmatrix} 1 & 2 & 3 & 4 \\ 4 & 1 & 2 & 3 \\ 3 & 4 & 1 & 2 \\ 2 & 3 & 4 & 1 \end{bmatrix}



      and


      B=[3412412312342341].B = \begin{bmatrix} 3 & 4 & 1 & 2 \\ 4 & 1 & 2 & 3 \\ 1 & 2 & 3 & 4 \\ 2 & 3 & 4 & 1 \end{bmatrix}.



      Let det⁡(A)\det(A) and det⁡(B)\det(B) denote the determinants of the matrices AA and BB, respectively.

      Which one of the options given below is TRUE?

      1. (a) det⁡(A)=det⁡(B)\det(A) = \det(B)
      2. (b) det⁡(B)=−det⁡(A)\det(B) = -\det(A)
      3. (c) det⁡(A)=0\det(A) = 0
      4. (d) det⁡(AB)=det⁡(A)+det⁡(B)\det(AB) = \det(A) + \det(B)
      Show answer

      (b) det⁡(B)=−det⁡(A)\det(B) = -\det(A)

    22. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let


      f(x)=x3+15x2−33x−36f(x) = x^3 + 15x^2 - 33x - 36



      be a real-valued function.

      Which of the following statements is/are TRUE?

      1. (a) f(x)f(x) does not have a local maximum.
      2. (b) f(x)f(x) has a local maximum.
      3. (c) f(x)f(x) does not have a local minimum.
      4. (d) f(x)f(x) has a local minimum.
      Show answer

      ()

    23. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let AA be the adjacency matrix of the graph with vertices {1,2,3,4,5}\{1, 2, 3, 4, 5\}.

      The graph has edges 1–2, 2–3, 2–4, 3–5, 4–5, a self-loop at vertex 3 and a self-loop at vertex 4.

      Let λ1,λ2,λ3,λ4,\lambda_1, \lambda_2, \lambda_3, \lambda_4, and λ5\lambda_5 be the five eigenvalues of AA. Note that these eigenvalues need not be distinct.

      The value of λ1+λ2+λ3+λ4+λ5=\lambda_1 + \lambda_2 + \lambda_3 + \lambda_4 + \lambda_5 = ____________.

    24. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The value of the definite integral



      ∫−33∫−22∫−11(4x2y−z3)dz dy dx\int_{-3}^{3}\int_{-2}^{2}\int_{-1}^{1} \left(4x^2y - z^3\right) \mathrm{d}z\,\mathrm{d}y\,\mathrm{d}x




      is ____________ . (Rounded off to the nearest integer)

    25. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      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)\mathit{tr}(AB) = \mathit{tr}(BA)
      Statement 2: tr(CD)=tr(DC)\mathit{tr}(CD) = \mathit{tr}(DC)

      where tr()\mathit{tr}() represents the trace of a matrix. Which one of the following holds?

      1. (a) Statement 1 is correct and Statement 2 is wrong.
      2. (b) Statement 1 is wrong and Statement 2 is correct.
      3. (c) Both Statement 1 and Statement 2 are correct.
      4. (d) Both Statement 1 and Statement 2 are wrong.
      Show answer

      (c) Both Statement 1 and Statement 2 are correct.

    26. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The value of the following limit is _____________.



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


    27. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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}, \quad 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?

      1. (a) L32=2L_{32} = 2, U33=−12U_{33} = -\dfrac{1}{2}, x1=−1x_1 = -1
      2. (b) L32=2L_{32} = 2, U33=2U_{33} = 2, x1=−1x_1 = -1
      3. (c) L32=−12L_{32} = -\dfrac{1}{2}, U33=2U_{33} = 2, x1=0x_1 = 0
      4. (d) L32=−12L_{32} = -\dfrac{1}{2}, U33=−12U_{33} = -\dfrac{1}{2}, x1=0x_1 = 0
      Show answer

      (d) L32=−12L_{32} = -\dfrac{1}{2}, U33=−12U_{33} = -\dfrac{1}{2}, x1=0x_1 = 0

    28. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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}


      1. (a) (−1101)\begin{pmatrix} -1 \\ 1 \\ 0 \\ 1 \end{pmatrix}
      2. (b) (10−10)\begin{pmatrix} 1 \\ 0 \\ -1 \\ 0 \end{pmatrix}
      3. (c) (−1022)\begin{pmatrix} -1 \\ 0 \\ 2 \\ 2 \end{pmatrix}
      4. (d) (01−30)\begin{pmatrix} 0 \\ 1 \\ -3 \\ 0 \end{pmatrix}
      Show answer

      ()

    29. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following expression.



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




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

    30. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Suppose that PP is a 4×54 \times 5 matrix such that every solution of the equation Px=0P\mathbf{x} = 0 is a scalar multiple of [2    5    4    3    1]T[2 \;\; 5 \;\; 4 \;\; 3 \;\; 1]^T. The rank of PP is __________.

    31. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

    32. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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



      s(P,Q)=∑i=1n(P[i]⋅Q[i])s(P, Q) = \sum_{i=1}^{n} (P[i] \cdot Q[i])




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

      1. (a) 9
      2. (b) 10
      3. (c) 11
      4. (d) 100
      Show answer

      (b) 10

    33. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following matrix.



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




      The largest eigenvalue of the above matrix is ______.

    34. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the functions

      I. e−xe^{-x}

      II. x2−sin⁡xx^2-\sin x

      III. x3+1\sqrt{x^3+1}

      Which of the above functions is/are increasing everywhere in [0,1][0,1]?

      1. (a) III only
      2. (b) II only
      3. (c) II and III only
      4. (d) I and III only
      Show answer

      (a) III only

    35. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let AA and BB be two n×nn \times n matrices over real numbers. Let rank(M)\mathrm{rank}(M) and det⁡(M)\det(M) denote the rank and determinant of a matrix MM, respectively. Consider the following statements.

      I. rank(AB)=rank(A) rank(B)\mathrm{rank}(AB) = \mathrm{rank}(A)\,\mathrm{rank}(B)

      II. det⁡(AB)=det⁡(A)det⁡(B)\det(AB) = \det(A)\det(B)

      III. rank(A+B)≤rank(A)+rank(B)\mathrm{rank}(A+B) \le \mathrm{rank}(A) + \mathrm{rank}(B)

      IV. det⁡(A+B)≤det⁡(A)+det⁡(B)\det(A+B) \le \det(A) + \det(B)

      Which of the above statements are TRUE?

      1. (a) I and II only
      2. (b) I and IV only
      3. (c) II and III only
      4. (d) III and IV only
      Show answer

      (c) II and III only

    36. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let XX be a square matrix. Consider the following two statements on XX.

      I. XX is invertible.

      II. Determinant of XX is non-zero.

      Which one of the following is TRUE?

      1. (a) I implies II; II does not imply I.
      2. (b) II implies I; I does not imply II.
      3. (c) I does not imply II; II does not imply I.
      4. (d) I and II are equivalent statements.
      Show answer

      (d) I and II are equivalent statements.

    37. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Compute lim⁡x→3x4−812x2−5x−3\displaystyle\lim_{x \to 3} \dfrac{x^4 - 81}{2x^2 - 5x - 3}

      1. (a) 1
      2. (b) 53/12
      3. (c) 108/7
      4. (d) Limit does not exist
      Show answer

      (c) 108/7

    38. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following matrix:



      R=[1248139271416641525125]R = \begin{bmatrix} 1 & 2 & 4 & 8 \\ 1 & 3 & 9 & 27 \\ 1 & 4 & 16 & 64 \\ 1 & 5 & 25 & 125 \end{bmatrix}




      The absolute value of the product of Eigen values of RR is ________.

  2. 02Equations, probability and numerical methods1 ch · 10 min24 PYQ
    1. Probability and statistics for engineers 10′
    See the 24 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      An urn contains one red ball and one blue ball. At each step, a ball is picked uniformly at random from the urn, and this ball together with another ball of the same color is put back in the urn. The probability that there are equal number of red and blue balls after two steps is

      1. (a) 1/4
      2. (b) 1/3
      3. (c) 1/2
      4. (d) 2/3
      Show answer

      (b) 1/3

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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), \quad x \in (-\infty, +\infty)




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

      1. (a) XX is an exponential random variable
      2. (b) XX is a normal random variable
      3. (c) XX is a Poisson random variable
      4. (d) XX is a uniform random variable
      Show answer

      (b) XX is a normal random variable

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let XX be a random variable which takes values in the set {1,2,3,4,5,6,7,8}\{1, 2, 3, 4, 5, 6, 7, 8\}. Further, Pr⁡(X=1)=Pr⁡(X=2)=Pr⁡(X=5)=Pr⁡(X=7)=16\Pr(X = 1) = \Pr(X = 2) = \Pr(X = 5) = \Pr(X = 7) = \dfrac{1}{6} and Pr⁡(X=3)=Pr⁡(X=4)=Pr⁡(X=6)=Pr⁡(X=8)=112\Pr(X = 3) = \Pr(X = 4) = \Pr(X = 6) = \Pr(X = 8) = \dfrac{1}{12}.

      The expected value of XX, denoted by E[X]E[X], is equal to ___________. (*rounded off to two decimal places*)

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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)

    5. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A box contains 5 coins: 4 regular coins and 1 fake coin. When a regular coin is tossed, the probability P(head)=0.5P(\mathit{head}) = 0.5 and for a fake coin, P(head)=1P(\mathit{head}) = 1. You pick a coin at random and toss it twice, and get two heads. The probability that the coin you have chosen is the fake coin is _______. (rounded off to two decimal places)

    6. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Suppose a 5-bit message is transmitted from a source to a destination through a noisy channel. The probability that a bit of the message gets flipped during transmission is 0.01. Flipping of each bit is independent of one another. The probability that the message is delivered error-free to the destination is ______ . (rounded off to three decimal places)

    7. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a probability distribution given by the density function P(x)P(x).



      P(x)={Cx2,for 1≤x≤40,for x<1 or x>4P(x) = \begin{cases} Cx^2, & \text{for } 1 \le x \le 4 \\ 0, & \text{for } x < 1 \text{ or } x > 4 \end{cases}




      The probability that xx lies between 2 and 3, i.e., P(2≤x≤3)P(2 \le x \le 3) is __________. (rounded off to three decimal places)

    8. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A quadratic polynomial (x−α)(x−β)(x - \alpha)(x - \beta) over complex numbers is said to be square invariant if (x−α)(x−β)=(x−α2)(x−β2)(x - \alpha)(x - \beta) = (x - \alpha^{2})(x - \beta^{2}). Suppose from the set of all square invariant quadratic polynomials we choose one at random.

      The probability that the roots of the chosen polynomial are equal is __________. (rounded off to one decimal place)

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      The unit interval (0,1)(0,1) is divided at a point chosen uniformly distributed over (0,1)(0,1) in R\mathbb{R} into two disjoint subintervals.

      The expected length of the subinterval that contains 0.4 is ___________. (rounded off to two decimal places)

    10. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider a permutation sampled uniformly at random from the set of all permutations of {1,2,3,⋯ ,n}\{1, 2, 3, \cdots, n\} for some n≥4n \ge 4. Let XX be the event that 1 occurs before 2 in the permutation, and YY the event that 3 occurs before 4. Which one of the following statements is TRUE?

      1. (a) The events XX and YY are mutually exclusive
      2. (b) The events XX and YY are independent
      3. (c) Either event XX or YY must occur
      4. (d) Event XX is more likely than event YY
      Show answer

      (b) The events XX and YY are independent

    11. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      When six unbiased dice are rolled simultaneously, the probability of getting all distinct numbers (i.e., 1, 2, 3, 4, 5, and 6) is

      1. (a) 1324\dfrac{1}{324}
      2. (b) 5324\dfrac{5}{324}
      3. (c) 7324\dfrac{7}{324}
      4. (d) 11324\dfrac{11}{324}
      Show answer

      (b) 5324\dfrac{5}{324}

    12. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let AA and BB be two events in a probability space with P(A)=0.3P(A) = 0.3, P(B)=0.5P(B) = 0.5, and P(A∩B)=0.1P(A \cap B) = 0.1. Which of the following statements is/are TRUE?

      1. (a) The two events AA and BB are independent
      2. (b) P(A∪B)=0.7P(A \cup B) = 0.7
      3. (c) P(A∩Bc)=0.2P(A \cap B^c) = 0.2, where BcB^c is the complement of the event BB
      4. (d) P(Ac∩Bc)=0.4P(A^c \cap B^c) = 0.4, where AcA^c and BcB^c are the complements of the events AA and BB, respectively
      Show answer

      ()

    13. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let xx and yy be random variables, not necessarily independent, that take real values in the interval [0,1][0,1]. Let z=xyz = xy and let the mean values of x,y,zx, y, z be xˉ,yˉ,zˉ\bar{x}, \bar{y}, \bar{z}, respectively. Which one of the following statements is TRUE?

      1. (a) zˉ=xˉyˉ\bar{z} = \bar{x}\bar{y}
      2. (b) zˉ≤xˉyˉ\bar{z} \le \bar{x}\bar{y}
      3. (c) zˉ≥xˉ yˉ\bar{z} \ge \bar{x}\,\bar{y}
      4. (d) zˉ≤xˉ\bar{z} \le \bar{x}
      Show answer

      (d) zˉ≤xˉ\bar{z} \le \bar{x}

    14. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A bag contains 10 red balls and 15 blue balls. Two balls are drawn randomly without replacement. Given that the first ball drawn is red, the probability (*rounded off to 3 decimal places*) that both balls drawn are red is _________

    15. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a random experiment where two fair coins are tossed. Let AA be the event that denotes HEAD on both the throws, BB be the event that denotes HEAD on the first throw, and CC be the event that denotes HEAD on the second throw.

      Which of the following statements is/are TRUE?

      1. (a) AA and BB are independent.
      2. (b) AA and CC are independent.
      3. (c) BB and CC are independent.
      4. (d) Prob(B∣C)=Prob(B)\mathrm{Prob}(B \mid C) = \mathrm{Prob}(B)
      Show answer

      ()

    16. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The lifetime of a component of a certain type is a random variable whose probability density function is exponentially distributed with parameter 2. For a randomly picked component of this type, the probability that its lifetime exceeds the expected lifetime (rounded to 2 decimal places) is ______.

    17. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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 places) is __________.

    18. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      In an examination, a student can choose the order in which two questions (QuesA and QuesB) 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. | question | probability of answering correctly | marks | |---|---|---| | QuesA | 0.8 | 10 | | QuesB | 0.5 | 20 | 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 QuesA and then QuesB. Expected marks 14.
      2. (b) First QuesB and then QuesA. Expected marks 14.
      3. (c) First QuesB and then QuesA. Expected marks 22.
      4. (d) First QuesA and then QuesB. Expected marks 16.
      Show answer

      (d) First QuesA and then QuesB. Expected marks 16.

    19. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the two statements.

      S1S_1: There exist random variables XX and YY such that


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




      S2S_2: For all random variables XX and YY,


      Cov[X,Y]=E[∣X−E[X]∣ ∣Y−E[Y]∣]\mathrm{Cov}[X, Y] = \mathbb{E}\left[\lvert X - \mathbb{E}[X] \rvert\, \lvert Y - \mathbb{E}[Y] \rvert\right]




      Which one of the following choices is correct?

      1. (a) Both S1S_1 and S2S_2 are true.
      2. (b) S1S_1 is true, but S2S_2 is false.
      3. (c) S1S_1 is false, but S2S_2 is true.
      4. (d) Both S1S_1 and S2S_2 are false.
      Show answer

      (d) Both S1S_1 and S2S_2 are false.

    20. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A sender (S) transmits a signal, which can be one of the two kinds: HH and LL with probabilities 0.1 and 0.9 respectively, to a receiver (R).

      In the graph below, the weight of edge (u,v)(u, v) is the probability of receiving vv when uu is transmitted, where u,v∈{H,L}u, v \in \{H, L\}. For example, the probability that the received signal is LL given the transmitted signal was HH, is 0.7.

      [Edges from S to R: H→HH \rightarrow H weight 0.3, H→LH \rightarrow L weight 0.7, L→HL \rightarrow H weight 0.8, L→LL \rightarrow L weight 0.2.]

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

    21. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      For n>2n > 2, let a∈{0,1}na \in \{0,1\}^n be a non-zero vector. Suppose that xx is chosen uniformly at random from {0,1}n\{0,1\}^n. Then, the probability that ∑i=1naixi\sum_{i=1}^{n} a_i x_i is an odd number is \_\_\_\_\_\_\_.

    22. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Two numbers are chosen independently and uniformly at random from the set {1,2,…,13}\{1, 2, \ldots, 13\}. The probability (rounded off to 3 decimal places) that their 4-bit (unsigned) binary representations have the same most significant bit is ________.

    23. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let TT be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves aa and bb of TT are chosen uniformly and independently at random. The expected value of the distance between aa and bb in TT (i.e., the number of edges in the unique path between aa and bb) is (rounded off to 2 decimal places) ___________.

    24. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Suppose YY is distributed uniformly in the open interval (1,6). The probability that the polynomial 3x2+6xY+3Y+63x^2 + 6xY + 3Y + 6 has only real roots is (rounded off to 1 decimal place) ________.

Electronics and Communication Engineering1 module4 ch50 min36 PYQ
  1. 03Digital circuits4 ch · 50 min36 PYQ
    1. Number systems, Boolean algebra and K-maps 13′
    2. Logic gates, CMOS logic and combinational circuits 12′
    3. Latches, flip-flops, counters and state machines 13′
    4. Data converters and semiconductor memories 12′
    See the 36 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      Which one of the following options is not a property of Boolean Algebra? Note: + is OR operation, . is AND operation, and ′ is NOT operation

      1. (a) a+b=b+aa + b = b + a
      2. (b) a⋅a′=1a \cdot a' = 1
      3. (c) a+a′=1a + a' = 1
      4. (d) a⋅b=b⋅aa \cdot b = b \cdot a
      Show answer

      (b) a⋅a′=1a \cdot a' = 1

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the following Boolean expression of a function F :



      F(P,Q)=(Pˉ+Q)⊕(PˉQ)F(P, Q) = (\bar{P} + Q) \oplus (\bar{P}Q)




      Which of the following expressions is/are equivalent to F ?

      1. (a) P⊕Q‾\overline{P \oplus Q}
      2. (b) P⊕QP \oplus Q
      3. (c) Pˉ⊕Q\bar{P} \oplus Q
      4. (d) Pˉ⊕Qˉ\bar{P} \oplus \bar{Q}
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a 2-bit saturating up/down counter that performs the saturating up count when the input PP is 0, and the saturating down count when PP is 1. The Next State table of the counter is as shown. The counter is built as a synchronous sequential circuit using D flip-flops.

      | Input PP | Current State Q1Q_1 | Current State Q0Q_0 | Next State Q1+Q_1^{+} | Next State Q0+Q_0^{+} |
      |---|---|---|---|---|
      | 0 | 0 | 0 | 0 | 1 |
      | 0 | 0 | 1 | 1 | 0 |
      | 0 | 1 | 0 | 1 | 1 |
      | 0 | 1 | 1 | 1 | 1 |
      | 1 | 0 | 0 | 0 | 0 |
      | 1 | 0 | 1 | 0 | 0 |
      | 1 | 1 | 0 | 0 | 1 |
      | 1 | 1 | 1 | 1 | 0 |

      Which one of the following options corresponds to the expressions for the inputs of the D flip-flops, D1D_1 and D0D_0?

      1. (a) D1=P Q1+PˉQ0+Q1Q0D_1 = P\,Q_1 + \bar{P}Q_0 + Q_1Q_0 D0=P Q0+Pˉ Q1+Q1Q0‾D_0 = P\,Q_0 + \bar{P}\,Q_1 + Q_1\overline{Q_0}
      2. (b) D1=Pˉ Q1+PˉQ0+Q1Q0D_1 = \bar{P}\,Q_1 + \bar{P}Q_0 + Q_1Q_0 D0=Pˉ Q0‾+Pˉ Q1+Q1Q0‾D_0 = \bar{P}\,\overline{Q_0} + \bar{P}\,Q_1 + Q_1\overline{Q_0}
      3. (c) D1=Pˉ Q1‾+Pˉ Q0+Q1 Q0D_1 = \bar{P}\,\overline{Q_1} + \bar{P}\,Q_0 + Q_1\,Q_0 D0=Pˉ Q0+Pˉ Q1+Q1Q0‾D_0 = \bar{P}\,Q_0 + \bar{P}\,Q_1 + Q_1\overline{Q_0}
      4. (d) D1=P Q1‾+Pˉ Q0+Q1 Q0D_1 = P\,\overline{Q_1} + \bar{P}\,Q_0 + Q_1\,Q_0 D0=P Q0‾+Pˉ Q1+Q1Q0‾D_0 = P\,\overline{Q_0} + \bar{P}\,Q_1 + Q_1\overline{Q_0}
      Show answer

      (b) D1=Pˉ Q1+PˉQ0+Q1Q0D_1 = \bar{P}\,Q_1 + \bar{P}Q_0 + Q_1Q_0 D0=Pˉ Q0‾+Pˉ Q1+Q1Q0‾D_0 = \bar{P}\,\overline{Q_0} + \bar{P}\,Q_1 + Q_1\overline{Q_0}

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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, DD as LSB. Which one of the following options represents the minimal sum of products form for the above function?

      Note: + is OR operation, . is AND operation, ′ is NOT operation

      1. (a) A′+B′+C′+D′A' + B' + C' + D'
      2. (b) B′B'
      3. (c) A′⋅B′+A⋅BA' \cdot B' + A \cdot B
      4. (d) A′A'
      Show answer

      (b) B′B'

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a Boolean function FF with the following minterm expression:



      F(P,Q,R,S)=∑m (1,2,3,4,5,7,10,12,13,14)F(P, Q, R, S) = \sum m\,(1, 2, 3, 4, 5, 7, 10, 12, 13, 14)




      Which of the following options is/are the minimal sum-of-products expression(s) of FF ?

      1. (a) PˉS+QRˉ+PˉQˉR+QˉRSˉ\bar{P}S + Q\bar{R} + \bar{P}\bar{Q}R + \bar{Q}R\bar{S}
      2. (b) PˉS+QRˉ+PˉQˉR+PRSˉ\bar{P}S + Q\bar{R} + \bar{P}\bar{Q}R + PR\bar{S}
      3. (c) PˉS+QRˉ+PQSˉ+PRSˉ\bar{P}S + Q\bar{R} + PQ\bar{S} + PR\bar{S}
      4. (d) PˉS+QRˉ+PQSˉ+QˉRSˉ\bar{P}S + Q\bar{R} + PQ\bar{S} + \bar{Q}R\bar{S}
      Show answer

      ()

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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]. Circuit: A and B are the inputs of decoder Q, whose outputs are D0, D1, D2, D3. Multiplexer M (select lines S1, S0) has input 0 connected to D0, input 1 connected to constant 0, input 2 connected to constant 1 and input 3 connected to D3; its output is Y.

    7. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let XX be a 3-variable Boolean function that produces output as ‘1’ when at least two of the input variables are ‘1’. Which of the following statement(s) is/are CORRECT, where a,b,c,d,ea, b, c, d, e are Boolean variables?

      1. (a) X(a,b,X(c,d,e))=X(X(a,b,c),d,e)X(a, b, X(c, d, e)) = X(X(a, b, c), d, e)
      2. (b) X(a,b,X(a,b,c))=X(a,b,c)X(a, b, X(a, b, c)) = X(a, b, c)
      3. (c) X(a,b,X(a,c,d))=(X(a,b,a) AND X(c,d,c))X(a, b, X(a, c, d)) = (X(a, b, a) \text{ AND } X(c, d, c))
      4. (d) X(a,b,c)=X(a,X(a,b,c),X(a,c,c))X(a, b, c) = X(a, X(a, b, c), X(a, c, c))
      Show answer

      ()

    8. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following logic circuit diagram.

      Which is/are the CORRECT option(s) for the output function FF?

      1. (a) XY‾\overline{XY}
      2. (b) Xˉ+Yˉ+XYˉ\bar{X} + \bar{Y} + X\bar{Y}
      3. (c) XY‾+Xˉ+XYˉ\overline{XY} + \bar{X} + X\bar{Y}
      4. (d) X+YˉX + \bar{Y}
      Show answer

      ()

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      In a 4-bit ripple counter, if the period of the waveform at the last flip-flop is 64 microseconds, then the frequency of the ripple counter in kHz is ________. (Answer in integer)

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following four variable Boolean function in sum-of-product form



      F(b3,b2,b1,b0)=∑(0,2,4,8,10,11,12).F(b_3, b_2, b_1, b_0) = \sum(0, 2, 4, 8, 10, 11, 12).




      where the value of the function is computed by considering b3b2b1b0b_3 b_2 b_1 b_0 as a 4-bit binary number, where b3b_3 denotes the most significant bit and b0b_0 denotes the least significant bit. Note that there are no don’t care terms. Which ONE of the following options is the CORRECT minimized Boolean expression for FF?

      1. (a) bˉ1bˉ0+bˉ2bˉ0+b1bˉ2b3\bar{b}_1 \bar{b}_0 + \bar{b}_2 \bar{b}_0 + b_1 \bar{b}_2 b_3
      2. (b) bˉ1bˉ0+bˉ2bˉ0\bar{b}_1 \bar{b}_0 + \bar{b}_2 \bar{b}_0
      3. (c) bˉ2bˉ0+b1b2b3\bar{b}_2 \bar{b}_0 + b_1 b_2 b_3
      4. (d) bˉ0bˉ2+bˉ3\bar{b}_0 \bar{b}_2 + \bar{b}_3
      Show answer

      (a) bˉ1bˉ0+bˉ2bˉ0+b1bˉ2b3\bar{b}_1 \bar{b}_0 + \bar{b}_2 \bar{b}_0 + b_1 \bar{b}_2 b_3

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Given the following Karnaugh Map for a Boolean function F(w,x,y,z)F(w, x, y, z):

      | wxwx \ yzyz | | | | |
      |---|---|---|---|---|
      | | 1 | 0 | 0 | 1 |
      | | 0 | 1 | 1 | 0 |
      | | 0 | 1 | 1 | 0 |
      | | 1 | 0 | 0 | 1 |

      Which one or more of the following Boolean expression(s) represent(s) FF?

      1. (a) wˉxˉyˉzˉ+wxˉyˉzˉ+wˉxˉyzˉ+wxˉyzˉ+xz\bar{w}\bar{x}\bar{y}\bar{z} + w\bar{x}\bar{y}\bar{z} + \bar{w}\bar{x}y\bar{z} + w\bar{x}y\bar{z} + xz
      2. (b) wˉxˉyˉzˉ+wˉxˉyzˉ+wxˉyz+xz\bar{w}\bar{x}\bar{y}\bar{z} + \bar{w}\bar{x}y\bar{z} + w\bar{x}yz + xz
      3. (c) wˉxˉyˉzˉ+wxˉyˉzˉ+wxˉyˉz+xz\bar{w}\bar{x}\bar{y}\bar{z} + w\bar{x}\bar{y}\bar{z} + w\bar{x}\bar{y}z + xz
      4. (d) xˉzˉ+xz\bar{x}\bar{z} + xz
      Show answer

      ()

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Which of the following Boolean algebraic equation(s) is/are CORRECT?

      1. (a) AˉBC+ABˉCˉ+AˉBˉCˉ+ABˉC+ABC=BC+BˉCˉ+AˉBˉ\bar{A}BC + A\bar{B}\bar{C} + \bar{A}\bar{B}\bar{C} + A\bar{B}C + ABC = BC + \bar{B}\bar{C} + \bar{A}\bar{B}
      2. (b) AB+AˉC+BC=AB+AˉCAB + \bar{A}C + BC = AB + \bar{A}C
      3. (c) (A+C)(Aˉ+B)=AB+AˉC(A + C)(\bar{A} + B) = AB + \bar{A}C
      4. (d) (A+Bˉ+Dˉ)(C+D)(Aˉ+C+D)(A+B+Dˉ)‾=AˉD+CˉDˉ\overline{(A + \bar{B} + \bar{D})(C + D)(\bar{A} + C + D)(A + B + \bar{D})} = \bar{A}D + \bar{C}\bar{D}
      Show answer

      ()

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a finite state machine (FSM) with one input XX and one output ff, represented by the given state transition table. The minimum number of states required to realize this FSM is ________. (Answer in integer)

      | Present state | Next state X=0X=0 | Next state X=1X=1 | Output ff X=0X=0 | Output ff X=1X=1 |
      |---|---|---|---|---|
      | A | F | B | 0 | 0 |
      | B | D | C | 0 | 0 |
      | C | F | E | 0 | 0 |
      | D | G | A | 1 | 0 |
      | E | D | C | 0 | 0 |
      | F | F | B | 1 | 1 |
      | G | G | H | 0 | 1 |
      | H | G | A | 1 | 0 |

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the given sequential circuit designed using D-Flip-flops. The circuit is initialized with some value (initial state). The number of distinct states the circuit will go through before returning back to the initial state is _________ . (Answer in integer)

    15. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the circuit shown below where the gates may have propagation delays. Assume that all signal transitions occur instantaneously and that wires have no delays. Which of the following statements about the circuit is/are CORRECT?

      1. (a) With no propagation delays, the output Y\boldsymbol{Y} is always logic Zero
      2. (b) With no propagation delays, the output Y\boldsymbol{Y} is always logic One
      3. (c) With propagation delays, the output Y\boldsymbol{Y} can have a transient logic One after X\boldsymbol{X} transitions from logic Zero to logic One
      4. (d) With propagation delays, the output Y\boldsymbol{Y} can have a transient logic Zero after X\boldsymbol{X} transitions from logic One to logic Zero
      Show answer

      ()

    16. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      For a Boolean variable xx, which of the following statements is/are FALSE?

      1. (a) x.1=xx.1 = x
      2. (b) x+1=xx + 1 = x
      3. (c) x.x=0x.x = 0
      4. (d) x+xˉ=1x + \bar{x} = 1
      Show answer

      ()

    17. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a Boolean expression given by F(X,Y,Z)=∑(3,5,6,7)F(X, Y, Z) = \sum(3,5,6,7).

      Which of the following statements is/are CORRECT?

      1. (a) F(X,Y,Z)=Π(0,1,2,4)F(X, Y, Z) = \Pi(0,1,2,4)
      2. (b) F(X,Y,Z)=XY+YZ+XZF(X, Y, Z) = XY + YZ + XZ
      3. (c) F(X,Y,Z)F(X, Y, Z) is independent of input YY
      4. (d) F(X,Y,Z)F(X, Y, Z) is independent of input XX
      Show answer

      ()

    18. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider 4-variable functions f1, f2, f3, f4 expressed in sum-of-minterms form as given below.



      f1=∑(0,2,3,5,7,8,11,13)f1 = \sum(0,2,3,5,7,8,11,13)





      f2=∑(1,3,5,7,11,13,15)f2 = \sum(1,3,5,7,11,13,15)





      f3=∑(0,1,4,11)f3 = \sum(0,1,4,11)





      f4=∑(0,2,6,13)f4 = \sum(0,2,6,13)




      Circuit: f1 and f2 feed a two-input AND gate; f3 and f4 feed a two-input OR gate; the outputs of the AND gate and the OR gate feed a two-input XOR gate whose output is Y\boldsymbol{Y}.

      With respect to the circuit given above, which of the following options is/are CORRECT?

      1. (a) Y=∑(0,1,2,11,13)\boldsymbol{Y} = \sum(0,1,2,11,13)
      2. (b) Y=Π(3,4,5,6,7,8,9,10,12,14,15)\boldsymbol{Y} = \Pi(3,4,5,6,7,8,9,10,12,14,15)
      3. (c) Y=∑(0,1,2,3,4,5,6,7)\boldsymbol{Y} = \sum(0,1,2,3,4,5,6,7)
      4. (d) Y=Π(8,9,10,11,12,13,14,15)\boldsymbol{Y} = \Pi(8,9,10,11,12,13,14,15)
      Show answer

      ()

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a digital logic circuit consisting of three 2-to-1 multiplexers M1, M2, and M3 as shown below. X1 and X2 are inputs of M1. X3 and X4 are inputs of M2. A, B, and C are select lines of M1, M2, and M3, respectively. For an instance of inputs **X1=1, X2=1, X3=0**, and **X4=0**, the number of combinations of A, B, C that give the output **Y=1** is _________

    20. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The output of a 2-input multiplexer is connected back to one of its inputs as shown in the figure. Match the functional equivalence of this circuit to one of the following options.

      1. (a) D Flip-flop
      2. (b) D Latch
      3. (c) Half-adder
      4. (d) Demultiplexer
      Show answer

      (b) D Latch

    21. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A 4 kilobyte (KB) byte-addressable memory is realized using four 1 KB memory blocks. Two input address lines (IA4 and IA3) are connected to the chip select (CS) port of these memory blocks through a decoder as shown in the figure. The remaining ten input address lines from IA11–IA0 are connected to the address port of these blocks. The chip select (CS) is active high. The input memory addresses (IA11–IA0), in decimal, for the starting locations (Addr=0) of each block (indicated as X1, X2, X3, X4 in the figure) are among the options given below. Which one of the following options is CORRECT?

      1. (a) (0, 1, 2, 3)
      2. (b) (0, 1024, 2048, 3072)
      3. (c) (0, 8, 16, 24)
      4. (d) (0, 0, 0, 0)
      Show answer

      (c) (0, 8, 16, 24)

    22. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a sequential digital circuit consisting of T flip-flops and D flip-flops as shown in the figure. CLKIN is the clock input to the circuit. At the beginning, Q1, Q2 and Q3 have values 0, 1 and 1, respectively. Which one of the given values of (Q1, Q2, Q3) can NEVER be obtained with this digital circuit?

      1. (a) (0, 0, 1)
      2. (b) (1, 0, 0)
      3. (c) (1, 0, 1)
      4. (d) (1, 1, 1)
      Show answer

      (a) (0, 0, 1)

    23. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A Boolean digital circuit is composed using two 4-input multiplexers (M1 and M2) and one 2-input multiplexer (M3) as shown in the figure. X0–X7 are the inputs of the multiplexers M1 and M2 and could be connected to either 0 or 1. The select lines of the multiplexers are connected to Boolean variables A, B and C as shown.

      Which one of the following set of values of (X0, X1, X2, X3, X4, X5, X6, X7) will realise the Boolean function A‾+A‾.C‾+A.B‾.C\overline{A} + \overline{A}.\overline{C} + A.\overline{B}.C?

      1. (a) (1, 1, 0, 0, 1, 1, 1, 0)
      2. (b) (1, 1, 0, 0, 1, 1, 0, 1)
      3. (c) (1, 1, 0, 1, 1, 1, 0, 0)
      4. (d) (0, 0, 1, 1, 0, 1, 1, 1)
      Show answer

      (c) (1, 1, 0, 1, 1, 1, 0, 0)

    24. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a digital display system (DDS) shown in the figure that displays the contents of register X. A 16-bit code word is used to load a word in X, either from S or from R. S is a 1024-word memory segment and R is a 32-word register file. Based on the value of mode bit M, T selects an input word to load in X. P and Q interface with the corresponding bits in the code word to choose the addressed word. Which one of the following represents the functionality of P, Q, and T?

      1. (a) P is 10:1 multiplexer; Q is 5:1 multiplexer; T is 2:1 multiplexer
      2. (b) P is 10:2102^{10} decoder; Q is 5:252^5 decoder; T is 2:1 encoder
      3. (c) P is 10:2102^{10} decoder; Q is 5:252^5 decoder; T is 2:1 multiplexer
      4. (d) P is 1:10 de-multiplexer; Q is 1:5 de-multiplexer; T is 2:1 multiplexer
      Show answer

      (c) P is 10:2102^{10} decoder; Q is 5:252^5 decoder; T is 2:1 multiplexer

    25. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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) A 4×14 \times 1 multiplexer with select lines s1=ys_1 = y, s0=zs_0 = z and data inputs I0=1I_0 = 1, I1=1I_1 = 1, I2=xI_2 = x, I3=x′I_3 = x'; output ff
      2. (b) A 4×14 \times 1 multiplexer with select lines s1=ys_1 = y, s0=zs_0 = z and data inputs I0=xI_0 = x, I1=1I_1 = 1, I2=x′I_2 = x', I3=1I_3 = 1; output ff
      3. (c) A 4×14 \times 1 multiplexer with select lines s1=ys_1 = y, s0=zs_0 = z and data inputs I0=1I_0 = 1, I1=1I_1 = 1, I2=x′I_2 = x', I3=xI_3 = x; output ff
      4. (d) A 4×14 \times 1 multiplexer with select lines s1=ys_1 = y, s0=zs_0 = z and data inputs I0=x′I_0 = x', I1=1I_1 = 1, I2=xI_2 = x, I3=1I_3 = 1; output ff
      Show answer

      (a) A 4×14 \times 1 multiplexer with select lines s1=ys_1 = y, s0=zs_0 = z and data inputs I0=1I_0 = 1, I1=1I_1 = 1, I2=xI_2 = x, I3=x′I_3 = x'; output ff

    26. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a 3-bit counter, designed using T flip-flops, as shown below: Assuming the initial state of the counter given by PQR as 000, what are the next three states?

      1. (a) 011, 101, 000
      2. (b) 001, 010, 111
      3. (c) 011, 101, 111
      4. (d) 001, 010, 000
      Show answer

      (a) 011, 101, 000

    27. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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 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 ss, tt, bb and yy respectively.

      Assume the initial state of the Mealy machine is 0.

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

      1. (a) t=s+bt = s + b, y=sby = sb
      2. (b) t=bt = b, y=sby = sb
      3. (c) t=bt = b, y=sb‾y = s\overline{b}
      4. (d) t=s+bt = s + b, y=sb‾y = s\overline{b}
      Show answer

      (b) t=bt = b, y=sby = sb

    28. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following Boolean expression.



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




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

      1. (a) (X‾+Y‾+Z‾)(X+Y‾)(Y+Z‾)(\overline{X} + \overline{Y} + \overline{Z})(X + \overline{Y})(Y + \overline{Z})
      2. (b) XY‾+Z‾X\overline{Y} + \overline{Z}
      3. (c) (X+Z‾)(Y‾+Z‾)(X + \overline{Z})(\overline{Y} + \overline{Z})
      4. (d) XY‾+YZ‾+X‾ Y‾ Z‾X\overline{Y} + Y\overline{Z} + \overline{X}\,\overline{Y}\,\overline{Z}
      Show answer

      ()

    29. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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



      f(w,0,0,z)=1f(w, 0, 0, z) = 1





      f(1,x,1,z)=x+zf(1, x, 1, z) = x + z





      f(w,1,y,z)=wz+yf(w, 1, y, z) = wz + y




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

    30. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A multiplexer is placed between a group of 32 registers and an accumulator to regulate data movement such that at any given point in time the content of only one register will move to the accumulator. The minimum number of select lines needed for the multiplexer is \_\_\_\_\_\_\_.

    31. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      If there are mm input lines and nn output lines for a decoder that is used to uniquely address a byte addressable 1 KB RAM, then the minimum value of m+nm+n is \_\_\_\_\_\_.

    32. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the Boolean function z(a,b,c)z(a,b,c).

      Which one of the following minterm lists represents the circuit given above?

      1. (a) z=∑(0,1,3,7)z = \sum(0,1,3,7)
      2. (b) z=∑(1,4,5,6,7)z = \sum(1,4,5,6,7)
      3. (c) z=∑(2,4,5,6,7)z = \sum(2,4,5,6,7)
      4. (d) z=∑(2,3,5)z = \sum(2,3,5)
      Show answer

      (b) z=∑(1,4,5,6,7)z = \sum(1,4,5,6,7)

    33. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The chip select logic for a certain DRAM chip in a memory system design is shown below. Assume that the memory system has 16 address lines denoted by A15A_{15} to A0A_0. What is the range of addresses (in hexadecimal) of the memory system that can get enabled by the chip select (CS) signal?

      1. (a) C800 to CFFF
      2. (b) CA00 to CAFF
      3. (c) C800 to C8FF
      4. (d) DA00 to DFFF
      Show answer

      (a) C800 to CFFF

    34. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following is NOT a valid identity?

      1. (a) (x⊕y)⊕z=x⊕(y⊕z)(x \oplus y) \oplus z = x \oplus (y \oplus z)
      2. (b) (x+y)⊕z=x⊕(y+z)(x + y) \oplus z = x \oplus (y + z)
      3. (c) x⊕y=x+yx \oplus y = x + y, if xy=0xy = 0
      4. (d) x⊕y=(xy+x′y′)′x \oplus y = (xy + x'y')'
      Show answer

      (b) (x+y)⊕z=x⊕(y+z)(x + y) \oplus z = x \oplus (y + z)

    35. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider three 4-variable functions f1f_1, f2f_2, and f3f_3, which are expressed in sum-of-minterms as f1=Σ(0,2,5,8,14)f_1 = \Sigma(0, 2, 5, 8, 14), f2=Σ(2,3,6,8,14,15)f_2 = \Sigma(2, 3, 6, 8, 14, 15), f3=Σ(2,7,11,14)f_3 = \Sigma(2, 7, 11, 14). For the following circuit with one AND gate and one XOR gate, the output function f can be expressed as:

      1. (a) Σ(7,8,11)\Sigma(7, 8, 11)
      2. (b) Σ(2,7,8,11,14)\Sigma(2, 7, 8, 11, 14)
      3. (c) Σ(2,14)\Sigma(2, 14)
      4. (d) Σ(0,2,3,5,6,7,8,11,14,15)\Sigma(0, 2, 3, 5, 6, 7, 8, 11, 14, 15)
      Show answer

      (a) Σ(7,8,11)\Sigma(7, 8, 11)

    36. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      What is the minimum number of 2-input NOR gates required to implement a 4-variable function expressed in sum-of-minterms form as f=Σ(0,2,5,7,8,10,13,15)f = \Sigma(0, 2, 5, 7, 8, 10, 13, 15)? Assume that all the inputs and their complements are available. Answer: _______________.

Computer Science and IT12 modules51 ch13 h 4 min561 PYQ
  1. 04Discrete mathematics5 ch · 1 h 22 min54 PYQ
    1. Propositional and first-order logic 17′
    2. Sets, relations, functions, posets and lattices 16′
    3. Combinatorics, recurrence relations and generating functions 16′
    4. Graph theory: connectivity, matching and colouring 17′
    5. Monoids and groups 16′
    See the 54 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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 (i): 16 cities arranged in a 4×44 \times 4 square grid, with a highway between every pair of horizontally or vertically adjacent cities.

      Figure (ii): 5 cities U, V, W, X, Y with highways U–V, U–W, U–X, W–Y, X–Y and V–Y.

      1. (a) Such a trip is possible for (i), but not for (ii).
      2. (b) Such a trip is possible for (ii), but not for (i).
      3. (c) Such a trip is possible for both (i) and (ii).
      4. (d) Such a trip is possible neither for (i) nor for (ii).
      Show answer

      (a) Such a trip is possible for (i), but not for (ii).

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      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?

      1. (a) (∃y)(∀x)((x≠y)→(M(x,y)∧¬M(y,x)))(\exists y)(\forall x)((x \ne y) \to (M(x, y) \land \neg M(y, x)))
      2. (b) (∀y)(∃x)((x≠y)→(M(x,y)∧¬M(y,x)))(\forall y)(\exists x)((x \ne y) \to (M(x, y) \land \neg M(y, x)))
      3. (c) (∃y)(∃x)((x≠y)→(M(x,y)∧¬M(y,x)))(\exists y)(\exists x)((x \ne y) \to (M(x, y) \land \neg M(y, x)))
      4. (d) (∀y)(∀x)((x≠y)→(M(x,y)∧¬M(y,x)))(\forall y)(\forall x)((x \ne y) \to (M(x, y) \land \neg M(y, x)))
      Show answer

      (a) (∃y)(∀x)((x≠y)→(M(x,y)∧¬M(y,x)))(\exists y)(\forall x)((x \ne y) \to (M(x, y) \land \neg M(y, x)))

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider 4×44 \times 4 matrices with their elements from {0,1}\{\mathbf{0}, \mathbf{1}\}. The number of such matrices with even number of $\mathbf{1}$s in every row and every column is

      1. (a) 512
      2. (b) 1025
      3. (c) 1023
      4. (d) 255
      Show answer

      (a) 512

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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?

      1. (a) Reflexive
      2. (b) Symmetric
      3. (c) Transitive
      4. (d) Antisymmetric
      Show answer

      ()

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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 ?

      1. (a) 1n\dfrac{1}{n}
      2. (b) 12n−3\dfrac{1}{2n-3}
      3. (c) 00
      4. (d) 1n−1\dfrac{1}{n-1}
      Show answer

      (c) 00

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let G(V,E)G(V, E) be a simple, undirected graph. A vertex cover of GG is a subset V′⊆VV' \subseteq V such that for every (u,v)∈E(u, v) \in E, u∈V′u \in V' or v∈V′v \in V'. Let the size of the smallest vertex cover in GG be kk. Let SS be any vertex cover of size kk.

      For a vertex v∈Vv \in V, which of the following constraints will always ensure that v∈Sv \in S ?

      1. (a) The degree of vv is at least k+1k + 1
      2. (b) The vertex vv is on a path of length k+1k + 1
      3. (c) The vertex vv is on a cycle of length k+1k + 1
      4. (d) The vertex vv is a part of a clique of size kk
      Show answer

      (a) The degree of vv is at least k+1k + 1

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      An undirected, unweighted, simple graph G(V,E)G(V, E) is said to be 2-colorable if there exists a function c:V→{0,1}c: V \to \{0, 1\} such that for every (u,v)∈E(u, v) \in E, c(u)≠c(v)c(u) \ne c(v).

      Which of the following statements about 2-colorable graphs is/are true?

      1. (a) If GG is 2-colorable, then GG may contain cycles of odd length
      2. (b) If GG is 2-colorable, then GG may contain cycles of even length
      3. (c) An optimal algorithm for testing whether GG is 2-colorable runs in time Θ(∣V∣+∣E∣)\Theta(\lvert V \rvert + \lvert E \rvert), if GG is represented as an adjacency list
      4. (d) An optimal algorithm for testing whether GG is 2-colorable runs in time Θ(∣E∣log⁡∣V∣)\Theta(\lvert E \rvert \log \lvert V \rvert), if GG is represented as an adjacency list
      Show answer

      ()

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let GG be an undirected graph, which is a path on 8 vertices. The number of matchings in GG is ______. (*answer in integer*)

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let P(x)P(x) be an arbitrary predicate over the domain of natural numbers.

      Which ONE of the following statements is TRUE?

      1. (a) (P(0)∧(∀x [P(x)⇒P(x+1)]))⇒(∀x P(x))\big(P(0) \land (\forall x\, [P(x) \Rightarrow P(x+1)])\big) \Rightarrow \big(\forall x\, P(x)\big)
      2. (b) (P(0)∧(∀x [P(x)⇒P(x−1)]))⇒(∀x P(x))\big(P(0) \land (\forall x\, [P(x) \Rightarrow P(x-1)])\big) \Rightarrow \big(\forall x\, P(x)\big)
      3. (c) (P(1000)∧(∀x [P(x)⇒P(x−1)]))⇒(∀x P(x))\big(P(1000) \land (\forall x\, [P(x) \Rightarrow P(x-1)])\big) \Rightarrow \big(\forall x\, P(x)\big)
      4. (d) (P(1000)∧(∀x [P(x)⇒P(x+1)]))⇒(∀x P(x))\big(P(1000) \land (\forall x\, [P(x) \Rightarrow P(x+1)])\big) \Rightarrow \big(\forall x\, P(x)\big)
      Show answer

      (a) (P(0)∧(∀x [P(x)⇒P(x+1)]))⇒(∀x P(x))\big(P(0) \land (\forall x\, [P(x) \Rightarrow P(x+1)])\big) \Rightarrow \big(\forall x\, P(x)\big)

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      g(.)g(.) is a function from AA to BB, f(.)f(.) is a function from BB to CC, and their composition defined as f(g(.))f(g(.)) is a mapping from AA to CC.

      If f(.)f(.) and f(g(.))f(g(.)) are onto (surjective) functions, which ONE of the following is TRUE about the function g(.)g(.)?

      1. (a) g(.)g(.) must be an onto (surjective) function.
      2. (b) g(.)g(.) must be a one-to-one (injective) function.
      3. (c) g(.)g(.) must be a bijective function, that is, both one-to-one and onto.
      4. (d) g(.)g(.) is not required to be a one-to-one or onto function.
      Show answer

      (d) g(.)g(.) is not required to be a one-to-one or onto function.

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let SS be the set of all ternary strings defined over the alphabet {a,b,c}\{a, b, c\}. Consider all strings in SS that contain at least one occurrence of two consecutive symbols, that is, “aa”, “bb” or “cc”. The number of such strings of length 5 that are possible is _______. (Answer in integer)

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let F\mathcal{F} be the set of all functions from {1,…,n}\{1, \ldots, n\} to {0,1}\{0, 1\}. Define the binary relation ≼\preccurlyeq on F\mathcal{F} as follows:

      ∀f,g∈F\forall f, g \in \mathcal{F}, f≼gf \preccurlyeq g if and only if ∀x∈{1,…,n}\forall x \in \{1, \ldots, n\}, f(x)≤g(x)f(x) \le g(x), where 0≤10 \le 1.

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

      1. (a) ≼\preccurlyeq is a symmetric relation
      2. (b) (F,≼)(\mathcal{F}, \preccurlyeq) is a partial order
      3. (c) (F,≼)(\mathcal{F}, \preccurlyeq) is a lattice
      4. (d) ≼\preccurlyeq is an equivalence relation
      Show answer

      ()

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Which of the following predicate logic formulae/formula is/are CORRECT representation(s) of the statement: “Everyone has exactly one mother”?

      The meanings of the predicates used are:

      - mother(y,x)\mathit{mother}(y, x): yy is the mother of xx
      - noteq(x,y)\mathit{noteq}(x, y): xx and yy are not equal

      1. (a) ∀x∃y∃z(mother(y,x)∧¬mother(z,x))\forall x \exists y \exists z (\mathit{mother}(y, x) \land \neg \mathit{mother}(z, x))
      2. (b) ∀x∃y[mother(y,x)∧∀z(noteq(z,y)→¬mother(z,x))]\forall x \exists y [\mathit{mother}(y, x) \land \forall z (\mathit{noteq}(z, y) \to \neg \mathit{mother}(z, x))]
      3. (c) ∀x∀y[mother(y,x)→∃z(mother(z,x)∧¬noteq(z,y))]\forall x \forall y [\mathit{mother}(y, x) \to \exists z (\mathit{mother}(z, x) \land \neg \mathit{noteq}(z, y))]
      4. (d) ∀x∃y[mother(y,x)∧¬∃z(noteq(z,y)∧mother(z,x))]\forall x \exists y [\mathit{mother}(y, x) \land \neg \exists z (\mathit{noteq}(z, y) \land \mathit{mother}(z, x))]
      Show answer

      ()

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A={0,1,2,3,…}A = \{0, 1, 2, 3, \ldots \} is the set of non-negative integers. Let F be the set of functions from AA to itself. For any two functions, f1,f2∈Ff_1, f_2 \in \text{F}, we define



      (f1⊙f2)(n)=f1(n)+f2(n)(f_1 \odot f_2)(n) = f_1(n) + f_2(n)




      for every number nn in AA. Which of the following is/are CORRECT about the mathematical structure (F,⊙)(\text{F}, \odot)?

      1. (a) (F,⊙)(\text{F}, \odot) is an Abelian group.
      2. (b) (F,⊙)(\text{F}, \odot) is an Abelian monoid.
      3. (c) (F,⊙)(\text{F}, \odot) is a non-Abelian group.
      4. (d) (F,⊙)(\text{F}, \odot) is a non-Abelian monoid.
      Show answer

      (b) (F,⊙)(\text{F}, \odot) is an Abelian monoid.

    15. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let pp and qq be the following propositions:

      pp: Fail grade can be given.

      qq: Student scores more than 50% marks.

      Consider the statement: “Fail grade cannot be given when student scores more than 50% marks.”

      Which one of the following is the CORRECT representation of the above statement in propositional logic?

      1. (a) q→¬pq \to \neg p
      2. (b) q→pq \to p
      3. (c) p→qp \to q
      4. (d) ¬p→q\neg p \to q
      Show answer

      (a) q→¬pq \to \neg p

    16. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let AA be the adjacency matrix of a simple undirected graph GG. Suppose AA is its own inverse. Which one of the following statements is always TRUE?

      1. (a) GG is a cycle
      2. (b) GG is a perfect matching
      3. (c) GG is a complete graph
      4. (d) There is no such graph GG
      Show answer

      (b) GG is a perfect matching

    17. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let AA and BB be non-empty finite sets such that there exist one-to-one and onto functions (i) from AA to BB and (ii) from A×AA \times A to A∪BA \cup B. The number of possible values of ∣A∣\lvert A \rvert is __________

    18. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let PP be the partial order defined on the set {1,2,3,4}\{1,2,3,4\} as follows



      P={(x,x)∣x∈{1,2,3,4}}∪{(1,2),(3,2),(3,4)}P = \{(x, x) \mid x \in \{1,2,3,4\}\} \cup \{(1,2), (3,2), (3,4)\}




      The number of total orders on {1,2,3,4}\{1,2,3,4\} that contain PP is __________

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The chromatic number of a graph is the minimum number of colours used in a *proper* colouring of the graph. Let GG be any graph with nn vertices and chromatic number kk. Which of the following statements is/are always TRUE?

      1. (a) GG contains a complete subgraph with kk vertices
      2. (b) GG contains an independent set of size at least n/kn/k
      3. (c) GG contains at least k(k−1)/2k(k-1)/2 edges
      4. (d) GG contains a vertex of degree at least kk
      Show answer

      ()

    20. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the operators ◊\lozenge and □\square defined by a◊b=a+2ba \lozenge b = a + 2b, a□b=aba \square b = ab, for positive integers. Which of the following statements is/are TRUE?

      1. (a) Operator ◊\lozenge obeys the associative law
      2. (b) Operator □\square obeys the associative law
      3. (c) Operator ◊\lozenge over the operator □\square obeys the distributive law
      4. (d) Operator □\square over the operator ◊\lozenge obeys the distributive law
      Show answer

      ()

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      The chromatic number of a graph is the minimum number of colours used in a *proper* colouring of the graph. The chromatic number of the following graph is _________

      Graph on 8 vertices placed on an octagon and numbered 1 to 8 clockwise; vertex ii is joined to i±1i \pm 1 and i±3i \pm 3 (mod 8). Edges: 1–2, 2–3, 3–4, 4–5, 5–6, 6–7, 7–8, 8–1, 1–4, 2–5, 3–6, 4–7, 5–8, 6–1, 7–2, 8–3.

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let ZnZ_n be the group of integers {0,1,2,…,n−1}\{0, 1, 2, \dots, n-1\} with addition modulo nn as the group operation. The number of elements in the group Z2×Z3×Z4Z_2 \times Z_3 \times Z_4 that are their own inverses is ________

    23. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The Lucas sequence LnL_n is defined by the recurrence relation:



      Ln=Ln−1+Ln−2,forn≥3,L_n = L_{n-1} + L_{n-2}, \quad \text{for} \quad n \ge 3,




      with L1=1L_1 = 1 and L2=3L_2 = 3.

      Which one of the options given is TRUE?

      1. (a) Ln=(1+52)n+(1−52)nL_n = \left(\dfrac{1+\sqrt{5}}{2}\right)^n + \left(\dfrac{1-\sqrt{5}}{2}\right)^n
      2. (b) Ln=(1+52)n−(1−53)nL_n = \left(\dfrac{1+\sqrt{5}}{2}\right)^n - \left(\dfrac{1-\sqrt{5}}{3}\right)^n
      3. (c) Ln=(1+52)n+(1−53)nL_n = \left(\dfrac{1+\sqrt{5}}{2}\right)^n + \left(\dfrac{1-\sqrt{5}}{3}\right)^n
      4. (d) Ln=(1+52)n−(1−52)nL_n = \left(\dfrac{1+\sqrt{5}}{2}\right)^n - \left(\dfrac{1-\sqrt{5}}{2}\right)^n
      Show answer

      (a) Ln=(1+52)n+(1−52)nL_n = \left(\dfrac{1+\sqrt{5}}{2}\right)^n + \left(\dfrac{1-\sqrt{5}}{2}\right)^n

    24. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Geetha has a conjecture about integers, which is of the form



      ∀x(P(x)  ⟹  ∃yQ(x,y)),\forall x \Big(P(x) \implies \exists y Q(x, y)\Big),




      where PP is a statement about integers, and QQ is a statement about pairs of integers. Which of the following (one or more) option(s) would *imply* Geetha’s conjecture?

      1. (a) ∃x(P(x)∧∀yQ(x,y))\exists x \Big(P(x) \land \forall y Q(x, y)\Big)
      2. (b) ∀x∀yQ(x,y)\forall x \forall y Q(x, y)
      3. (c) ∃y∀x(P(x)  ⟹  Q(x,y))\exists y \forall x \Big(P(x) \implies Q(x, y)\Big)
      4. (d) ∃x(P(x)∧∃yQ(x,y))\exists x \Big(P(x) \land \exists y Q(x, y)\Big)
      Show answer

      ()

    25. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let U={1,2,…,n}U = \{1, 2, \ldots, n\}, where nn is a large positive integer greater than 1000. Let kk be a positive integer less than nn. Let A,BA, B be subsets of UU with ∣A∣=∣B∣=k\lvert A\rvert = \lvert B\rvert = k and A∩B=∅A \cap B = \emptyset. We say that a permutation of UU separates AA from BB if one of the following is true.

      - All members of AA appear in the permutation before any of the members of BB.
      - All members of BB appear in the permutation before any of the members of AA.

      How many permutations of UU separate AA from BB?

      1. (a) n!n!
      2. (b) (n2k)(n−2k)!\binom{n}{2k}(n - 2k)!
      3. (c) (n2k)(n−2k)! (k!)2\binom{n}{2k}(n - 2k)!\,(k!)^2
      4. (d) 2(n2k)(n−2k)! (k!)22\binom{n}{2k}(n - 2k)!\,(k!)^2
      Show answer

      (d) 2(n2k)(n−2k)! (k!)22\binom{n}{2k}(n - 2k)!\,(k!)^2

    26. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let f:A→Bf : A \to B be an onto (or surjective) function, where AA and BB are nonempty sets. Define an equivalence relation ∼\sim on the set AA as



      a1∼a2 if f(a1)=f(a2),a_1 \sim a_2 \text{ if } f(a_1) = f(a_2),




      where a1,a2∈Aa_1, a_2 \in A. Let E={[x]:x∈A}\mathcal{E} = \{[x] : x \in A\} be the set of all the equivalence classes under ∼\sim. Define a new mapping F:E→BF : \mathcal{E} \to B as



      F([x])=f(x),for all the equivalence classes [x] in E.F([x]) = f(x), \quad \text{for all the equivalence classes } [x] \text{ in } \mathcal{E}.




      Which of the following statements is/are TRUE?

      1. (a) FF is NOT well-defined.
      2. (b) FF is an onto (or surjective) function.
      3. (c) FF is a one-to-one (or injective) function.
      4. (d) FF is a bijective function.
      Show answer

      ()

    27. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let XX be a set and 2X2^X denote the powerset of XX.

      Define a binary operation Δ\Delta on 2X2^X as follows:



      AΔB=(A−B)∪(B−A).A \Delta B = (A - B) \cup (B - A).




      Let H=(2X,Δ)H = (2^X, \Delta). Which of the following statements about HH is/are correct?

      1. (a) HH is a group.
      2. (b) Every element in HH has an inverse, but HH is NOT a group.
      3. (c) For every A∈2XA \in 2^X, the inverse of AA is the complement of AA.
      4. (d) For every A∈2XA \in 2^X, the inverse of AA is AA.
      Show answer

      ()

    28. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let GG be a simple, finite, undirected graph with vertex set {v1,…,vn}\{v_1, \ldots, v_n\}. Let Δ(G)\Delta(G) denote the maximum degree of GG and let N={1,2,…}\mathbb{N} = \{1, 2, \ldots\} denote the set of all possible colors. Color the vertices of GG using the following greedy strategy:

      for i=1,…,ni = 1, \ldots, n



      color(vi)←min⁡{j∈N:no neighbour of vi is colored j}\mathrm{color}(v_i) \leftarrow \min\{j \in \mathbb{N} : \text{no neighbour of } v_i \text{ is colored } j\}




      Which of the following statements is/are TRUE?

      1. (a) This procedure results in a proper vertex coloring of GG.
      2. (b) The number of colors used is at most Δ(G)+1\Delta(G) + 1.
      3. (c) The number of colors used is at most Δ(G)\Delta(G).
      4. (d) The number of colors used is equal to the chromatic number of GG.
      Show answer

      ()

    29. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      1. (a) If for all x,y∈Gx, y \in G, (xy)2=x2y2(xy)^2 = x^2y^2, then GG is commutative.
      2. (b) If for all x∈Gx \in G, x2=1x^2 = 1, then GG is commutative. Here, 1 is the identity element of GG.
      3. (c) If the order of GG is 22, then GG is commutative.
      4. (d) If GG is commutative, then a subgroup of GG need not be commutative.
      Show answer

      ()

    30. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

    31. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The number of arrangements of six identical balls in three identical bins is______.

    32. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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}


      1. (a) x(1+x2)(1−x2)2+11−x\dfrac{x(1 + x^2)}{(1 - x^2)^2} + \dfrac{1}{1 - x}
      2. (b) x(3−x2)(1−x2)2+11−x\dfrac{x(3 - x^2)}{(1 - x^2)^2} + \dfrac{1}{1 - x}
      3. (c) 2x(1−x2)2+11−x\dfrac{2x}{(1 - x^2)^2} + \dfrac{1}{1 - x}
      4. (d) x(1−x2)2+11−x\dfrac{x}{(1 - x^2)^2} + \dfrac{1}{1 - x}
      Show answer

      (a) x(1+x2)(1−x2)2+11−x\dfrac{x(1 + x^2)}{(1 - x^2)^2} + \dfrac{1}{1 - x}

    33. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

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

      [Graph: an outer pentagon o1o2o3o4o5o_1 o_2 o_3 o_4 o_5, an inner five-pointed star on i1,…,i5i_1, \dots, i_5 with edges i1i3i_1 i_3, i3i5i_3 i_5, i5i2i_5 i_2, i2i4i_2 i_4, i4i1i_4 i_1, and spokes okiko_k i_k for k=1,…,5k = 1, \dots, 5.]

      Which of the following statements is/are TRUE?

      1. (a) The chromatic number of the graph is 3.
      2. (b) The graph has a Hamiltonian path.
      3. (c) The following graph is isomorphic to the Peterson graph. [Graph: a 9-cycle v1v2…v9v_1 v_2 \dots v_9 (in order around the boundary) and a centre vertex cc, with extra edges cv1c v_1, cv4c v_4, cv7c v_7, v2v6v_2 v_6, v3v8v_3 v_8, v5v9v_5 v_9.]
      4. (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.)
      Show answer

      ()

    34. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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, \text{ for } n \ge 1;





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




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

      1. (a) f(2n−1)=2n−1f(2^n - 1) = 2^n - 1
      2. (b) f(2n)=1f(2^n) = 1
      3. (c) f(5⋅2n)=2n+1+1f(5 \cdot 2^n) = 2^{n+1} + 1
      4. (d) f(2n+1)=2n+1f(2^n + 1) = 2^n + 1
      Show answer

      ()

    35. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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, & \mathit{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_____________.

    36. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let pp and qq be two propositions. Consider the following two formulae in propositional logic.

      S1S_1: (¬p∧(p∨q))→q(\neg p \wedge (p \vee q)) \rightarrow q
      S2S_2: q→(¬p∧(p∨q))q \rightarrow (\neg p \wedge (p \vee q))

      Which one of the following choices is correct?

      1. (a) Both S1S_1 and S2S_2 are tautologies.
      2. (b) S1S_1 is a tautology but S2S_2 is not a tautology.
      3. (c) S1S_1 is not a tautology but S2S_2 is a tautology.
      4. (d) Neither S1S_1 nor S2S_2 is a tautology.
      Show answer

      (b) S1S_1 is a tautology but S2S_2 is not a tautology.

    37. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

      S1S_1: Set of all n×nn \times 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, \ldots, 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.
      Show answer

      ()

    38. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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



      S:((P∧Q)→R)→((P∧Q)→(Q→R))S : ((P \land Q) \to R) \to ((P \land Q) \to (Q \to 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.
      Show answer

      ()

    39. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      There are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing speeds. Each job is assigned to a computer such that: - The fastest computer gets the toughest job and the slowest computer gets the easiest job. - Every computer gets at least one job. The number of ways in which this can be done is ______.

    41. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let GG be a group of order 6, and HH be a subgroup of GG such that 1<∣H∣<61 < \lvert H \rvert < 6. Which one of the following options is correct?

      1. (a) Both GG and HH are always cyclic.
      2. (b) GG may not be cyclic, but HH is always cyclic.
      3. (c) GG is always cyclic, but HH may not be cyclic.
      4. (d) Both GG and HH may not be cyclic.
      Show answer

      (b) GG may not be cyclic, but HH is always cyclic.

    42. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

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



      diam(G)=max⁡u,v∈V{the length of shortest path between u and v}\mathrm{diam}(G) = \max_{u, v \in V}\{\text{the length of shortest path between } u \text{ and } v\}




      Let MM be the adjacency matrix of GG.

      Define graph G2G_2 on the same set of vertices with adjacency matrix NN, where



      Nij={1if Mij>0 or Pij>0, where P=M20otherwiseN_{ij} = \begin{cases} 1 & \text{if } M_{ij} > 0 \text{ or } P_{ij} > 0, \text{ where } P = M^2 \\ 0 & \text{otherwise} \end{cases}




      Which one of the following statements is true?

      1. (a) diam(G2)≤⌈diam(G)/2⌉\mathrm{diam}(G_2) \le \lceil \mathrm{diam}(G)/2 \rceil
      2. (b) ⌈diam(G)/2⌉<diam(G2)<diam(G)\lceil \mathrm{diam}(G)/2 \rceil < \mathrm{diam}(G_2) < \mathrm{diam}(G)
      3. (c) diam(G2)=diam(G)\mathrm{diam}(G_2) = \mathrm{diam}(G)
      4. (d) diam(G)<diam(G2)≤2 diam(G)\mathrm{diam}(G) < \mathrm{diam}(G_2) \le 2\,\mathrm{diam}(G)
      Show answer

      (a) diam(G2)≤⌈diam(G)/2⌉\mathrm{diam}(G_2) \le \lceil \mathrm{diam}(G)/2 \rceil

    43. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A relation R\mathbf{R} is said to be *circular* if aRba\mathbf{R}b and bRcb\mathbf{R}c together imply cRac\mathbf{R}a.

      Which of the following options is/are correct?

      1. (a) If a relation S\mathbf{S} is reflexive and symmetric, then S\mathbf{S} is an equivalence relation.
      2. (b) If a relation S\mathbf{S} is circular and symmetric, then S\mathbf{S} is an equivalence relation.
      3. (c) If a relation S\mathbf{S} is reflexive and circular, then S\mathbf{S} is an equivalence relation.
      4. (d) If a relation S\mathbf{S} is transitive and circular, then S\mathbf{S} is an equivalence relation.
      Show answer

      (c) If a relation S\mathbf{S} is reflexive and circular, then S\mathbf{S} is an equivalence relation.

    44. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let SS be a set consisting of 10 elements. The number of tuples of the form (A,B)(A, B) such that AA and BB are subsets of SS, and A⊆BA \subseteq B is __________.

    45. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let R\mathcal{R} be the set of all binary relations on the set {1,2,3}\{1,2,3\}. Suppose a relation is chosen from R\mathcal{R} at random. The probability that the chosen relation is reflexive (round off to 3 decimal places) is \_\_\_\_\_\_\_.

    46. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let GG be a group of 35 elements. Then the largest possible size of a subgroup of GG other than GG itself is \_\_\_\_\_\_\_.

    47. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which one of the following predicate formulae is NOT logically valid?

      Note that WW is a predicate formula without any free occurrence of xx.

      1. (a) ∀x(p(x)∨W)≡∀x p(x)∨W\forall x(p(x) \lor W) \equiv \forall x\, p(x) \lor W
      2. (b) ∃x(p(x)∧W)≡∃x p(x)∧W\exists x(p(x) \land W) \equiv \exists x\, p(x) \land W
      3. (c) ∀x(p(x)→W)≡∀x p(x)→W\forall x(p(x) \to W) \equiv \forall x\, p(x) \to W
      4. (d) ∃x(p(x)→W)≡∀x p(x)→W\exists x(p(x) \to W) \equiv \forall x\, p(x) \to W
      Show answer

      (c) ∀x(p(x)→W)≡∀x p(x)→W\forall x(p(x) \to W) \equiv \forall x\, p(x) \to W

    48. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The number of permutations of the characters in LILAC so that no character appears in its original position, if the two L's are indistinguishable, is \_\_\_\_\_\_\_.

    49. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Graph GG is obtained by adding vertex ss to K3,4K_{3,4} and making ss adjacent to every vertex of K3,4K_{3,4}. The minimum number of colours required to edge-colour GG is \_\_\_\_\_\_\_.

    50. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let U={1,2,…,n}U = \{1, 2, \ldots, n\}. Let A={(x,X)∣x∈X,X⊆U}A = \{(x, X) \mid x \in X, X \subseteq U\}. Consider the following two statements on ∣A∣\lvert A\rvert.

      I. ∣A∣=n2n−1\lvert A\rvert = n2^{n-1}

      II. ∣A∣=∑k=1nk(nk)\lvert A\rvert = \sum_{k=1}^{n} k\binom{n}{k}

      Which of the above statements is/are TRUE?

      1. (a) Only I
      2. (b) Only II
      3. (c) Both I and II
      4. (d) Neither I nor II
      Show answer

      (c) Both I and II

    51. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let GG be an arbitrary group. Consider the following relations on GG:

      R1R_1: ∀a,b∈G\forall a, b \in G, aR1ba R_1 b if and only if ∃g∈G\exists g \in G such that a=g−1bga = g^{-1}bg

      R2R_2: ∀a,b∈G\forall a, b \in G, aR2ba R_2 b if and only if a=b−1a = b^{-1}

      Which of the above is/are equivalence relation/relations?

      1. (a) R1R_1 and R2R_2
      2. (b) R1R_1 only
      3. (c) R2R_2 only
      4. (d) Neither R1R_1 nor R2R_2
      Show answer

      (b) R1R_1 only

    52. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let GG be an undirected complete graph on nn vertices, where n>2n > 2. Then, the number of different Hamiltonian cycles in GG is equal to

      1. (a) n!n!
      2. (b) (n−1)!(n - 1)!
      3. (c) 11
      4. (d) (n−1)!2\dfrac{(n-1)!}{2}
      Show answer

      (c) 11

    53. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The value of 351 mod 53^{51} \bmod 5 is ________.

    54. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the first order predicate formula φ\varphi:



      ∀x [(∀z  z∣x⇒((z=x)∨(z=1)))⇒∃w (w>x)∧(∀z  z∣w⇒((w=z)∨(z=1)))]\forall x\, [(\forall z\; z \mid x \Rightarrow ((z = x) \vee (z = 1))) \Rightarrow \exists w\, (w > x) \wedge (\forall z\; z \mid w \Rightarrow ((w = z) \vee (z = 1)))]




      Here 'a∣ba \mid b' denotes that 'aa divides bb', where aa and bb are integers. Consider the following sets:

      S1. {1,2,3,…,100}\{1, 2, 3, \ldots, 100\}

      S2. Set of all positive integers

      S3. Set of all integers

      Which of the above sets satisfy φ\varphi?

      1. (a) S1 and S2
      2. (b) S1 and S3
      3. (c) S2 and S3
      4. (d) S1, S2 and S3
      Show answer

      (c) S2 and S3

  2. 05Digital logic1 ch · 18 min21 PYQ
    1. Number representation and computer arithmetic 18′
    See the 21 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the 8-bit signed integers XX, YY and ZZ represented using the sign-magnitude form. The binary representations of XX and YY are as follows:

      XX: 10110100 YY: 01001100

      Which of the following operations to compute ZZ result(s) in an arithmetic overflow?

      1. (a) Z=X+YZ = X + Y
      2. (b) Z=X−YZ = X - Y
      3. (c) Z=−X+YZ = -X + Y
      4. (d) Z=−X−YZ = -X - Y
      Show answer

      ()

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      In a system, numbers are represented using 4-bit two's complement form. Consider four numbers N1=1011N1 = 1011, N2=1101N2 = 1101, N3=1010N3 = 1010 and N4=1001N4 = 1001 in the system. Which of the following operations will result in arithmetic overflow?

      1. (a) N1+N2N1 + N2
      2. (b) N2+N3N2 + N3
      3. (c) N3−N4N3 - N4
      4. (d) N1+N4N1 + N4
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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)

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the real valued variables X, Y and Z represented using the IEEE 754 single-precision floating-point format. The binary representations of X and Y in hexadecimal notation are as follows:

      X: 35C00000 Y: 34A00000

      Let Z=X+YZ = X + Y.

      Which one of the following is the binary representation of ZZ, in hexadecimal notation?

      1. (a) 35C80000
      2. (b) 35CC0000
      3. (c) 35E80000
      4. (d) 35EC0000
      Show answer

      (c) 35E80000

    5. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The number −6-6 can be represented as 1010 in 4-bit 2’s complement representation. Which of the following is/are CORRECT 2’s complement representation(s) of −6-6?

      1. (a) 1000 1010 in 8-bits
      2. (b) 1111 1010 in 8-bits
      3. (c) 1000 0000 0000 1010 in 16-bits
      4. (d) 1111 1111 1111 1010 in 16-bits
      Show answer

      ()

    6. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      The following two signed 2’s complement numbers (multiplicand M and multiplier Q) are being multiplied using Booth’s algorithm: M: 1100 1101 1110 1101 and Q: 1010 0100 1010 1010 The total number of addition and subtraction operations to be performed is ___________. (Answer in integer)

    7. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Three floating point numbers XX, YY, and ZZ are stored in three registers R$_{X}$, R$_{Y}$, and R$_{Z}$, respectively in IEEE 754 single precision format as given below in hexadecimal:

      R$_{X}$ = 0xC1100000, R$_{Y}$ = 0x40C00000, and R$_{Z}$ = 0x41400000

      Which of the following option(s) is/are CORRECT?

      1. (a) 4(X+Y)+Z=04(X + Y) + Z = 0
      2. (b) 2Y−Z=02Y - Z = 0
      3. (c) 4X+3Z=04X + 3Z = 0
      4. (d) X+Y+Z=0X + Y + Z = 0
      Show answer

      ()

    8. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider a system that uses 5 bits for representing signed integers in 2’s complement format. In this system, two integers AA and BB are represented as A=01010A=01010 and B=11010B=11010. Which one of the following operations will result in either an arithmetic overflow or an arithmetic underflow?

      1. (a) A+BA+B
      2. (b) A−BA-B
      3. (c) B−AB-A
      4. (d) 2∗B2*B
      Show answer

      (b) A−BA-B

    9. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      The format of a single-precision floating-point number as per the **IEEE 754** standard is: | Sign (1bit) | Exponent (8 bits) | Mantissa (23 bits) | |---|---|---| Choose the largest floating-point number among the following options.

      1. (a) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 0111 1111 | 1111 1111 1111 1111 1111 111 |
      2. (b) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 1111 1110 | 1111 1111 1111 1111 1111 111 |
      3. (c) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 1111 1111 | 1111 1111 1111 1111 1111 111 |
      4. (d) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 0111 1111 | 0000 0000 0000 0000 0000 000 |
      Show answer

      (b) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 1111 1110 | 1111 1111 1111 1111 1111 111 |

    10. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Which of the following is/are EQUAL to 224 in radix-5 (i.e., base-5) notation?

      1. (a) 64 in radix-10
      2. (b) 100 in radix-8
      3. (c) 50 in radix-16
      4. (d) 121 in radix-7
      Show answer

      ()

    11. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A particular number is written as 132 in radix-4 representation. The same number in radix-5 representation is ____________.

    12. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the IEEE-754 single precision floating point numbers P=0xC1800000 and Q=0x3F5C2EF4. Which one of the following corresponds to the product of these numbers (i.e., P × Q), represented in the IEEE-754 single precision format?

      1. (a) 0x404C2EF4
      2. (b) 0x405C2EF4
      3. (c) 0xC15C2EF4
      4. (d) 0xC14C2EF4
      Show answer

      (c) 0xC15C2EF4

    13. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      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?

      1. (a) R1 = 1011 and R2 = 1110
      2. (b) R1 = 1100 and R2 = 1010
      3. (c) R1 = 0011 and R2 = 0100
      4. (d) R1 = 1001 and R2 = 1111
      Show answer

      (b) R1 = 1100 and R2 = 1010

    14. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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 = 0x41400000 |
      |---|---|---|

      Which one of the following is FALSE?

      1. (a) A+C=0A + C = 0
      2. (b) C=A+BC = A + B
      3. (c) B=3CB = 3C
      4. (d) (B−C)>0(B - C) > 0
      Show answer

      (b) C=A+BC = A + B

    15. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      1. (a) 15
      2. (b) 21
      3. (c) D2
      4. (d) 528
      Show answer

      (a) 15

    16. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

    17. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.

      SS : 1 \qquad EE : 10000001 \qquad FF : 11110000000000000000000

      Here SS, EE and FF denote the sign, exponent and fraction components of the floating point representation.

      The decimal value corresponding to the above representation (rounded to 2 decimal places) is ______.

    18. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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
      Show answer

      ()

    19. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider three registers R1, R2, and R3 that store numbers in IEEE-754 single precision floating point format. Assume that R1 and R2 contain the values (in hexadecimal notation) 0x42200000 and 0xC1200000, respectively.

      If R3=R1R2R3 = \dfrac{R1}{R2}, what is the value stored in R3?

      1. (a) 0x40800000
      2. (b) 0xC0800000
      3. (c) 0x83400000
      4. (d) 0xC8500000
      Show answer

      (b) 0xC0800000

    20. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      In 16-bit 2's complement representation, the decimal number −28-28 is:

      1. (a) 1111 1111 0001 1100
      2. (b) 0000 0000 1110 0100
      3. (c) 1111 1111 1110 0100
      4. (d) 1000 0000 1110 0100
      Show answer

      (c) 1111 1111 1110 0100

    21. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider Z = X – Y, where X, Y and Z are all in sign-magnitude form. X and Y are each represented in nn bits. To avoid overflow, the representation of Z would require a minimum of:

      1. (a) nn bits
      2. (b) n−1n - 1 bits
      3. (c) n+1n + 1 bits
      4. (d) n+2n + 2 bits
      Show answer

      (c) n+1n + 1 bits

  3. 06Computer organisation and architecture5 ch · 1 h 5 min54 PYQ
    1. Machine instructions and addressing modes 13′
    2. ALU, data-path and control unit 14′
    3. Instruction pipelining and hazards 12′
    4. Memory hierarchy and cache 14′
    5. I/O interface: interrupts and DMA 12′
    See the 54 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Match each addressing mode in List I with a data element or an element of a data structure (in a high-level language) in List II: | List I | List II | |---|---| | P. Immediate | 1. Element of an array | | Q. Indirect | 2. Pointer | | R. Base with index | 3. Element of a record | | S. Base with offset/displacement | 4. Constant |

      1. (a) P–4, Q–3, R–1, S–2
      2. (b) P–4, Q–2, R–1, S–3
      3. (c) P–1, Q–4, R–3, S–2
      4. (d) P–2, Q–3, R–1, S–4
      Show answer

      (b) P–4, Q–2, R–1, S–3

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider a processor P whose instruction set architecture is the load-store architecture. The instruction format is such that the first operand of any instruction is the destination operand. Which one of the following sequences of instructions corresponds to the high-level language statement Z = X + Y ? Note: X, Y, and Z are memory operands. R0, R1, and R2 are registers.

      1. (a) ADD Z, X, Y
      2. (b) LOAD R0, X ADD Z, R0, Y
      3. (c) ADD R0, X, Y STORE Z, R0
      4. (d) LOAD R0, X LOAD R1, Y ADD R2, R0, R1 STORE Z, R2
      Show answer

      (d) LOAD R0, X LOAD R1, Y ADD R2, R0, R1 STORE Z, R2

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Which one of the following dependencies among the register operands of different instructions can cause a data hazard in a pipelined processor?

      1. (a) Read-after-read
      2. (b) Read-after-write
      3. (c) Write-after-read
      4. (d) Write-after-write
      Show answer

      (b) Read-after-write

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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 ?

      1. (a) Both S1 and S2 are true
      2. (b) Both S1 and S2 are false
      3. (c) S1 is true and S2 is false
      4. (d) S1 is false and S2 is true
      Show answer

      (c) S1 is true and S2 is false

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      The size of the physical address space of a processor is 2322^{32} bytes. The capacity of a cache memory unit is 2232^{23} bytes. The cache block size is 128 bytes. The cache memory unit can be built as a direct mapped cache or as a KK-way set-associative cache, where K=2LK = 2^{L} and L∈{1,2,3}L \in \{1, 2, 3\}. Let the length of the TAG field be MM bits for the direct mapped cache, and NN bits for the set-associative cache.

      Which one of the following options is true?

      1. (a) N=M+LN = M + L
      2. (b) N=M−LN = M - L
      3. (c) N=M+KN = M + K
      4. (d) N=M−KN = M - K
      Show answer

      (a) N=M+LN = M + L

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) 8
      2. (b) 4
      3. (c) 64
      4. (d) 16
      Show answer

      (b) 4

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      Note: 1K=2101\text{K} = 2^{10} and 1M=2201\text{M} = 2^{20}

      1. (a) Every access to P results in a cache miss
      2. (b) Every access to R results in a cache hit
      3. (c) Every access to Q results in a cache miss
      4. (d) Except the first access to S, all subsequent accesses to S result in cache hits
      Show answer

      ()

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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 17610176_{10}. The maximum possible size of the cache (in KB) for this configuration is ___________. (answer in integer)

      Note: 1K=2101\text{K} = 2^{10} and 1M=2201\text{M} = 2^{20}

    9. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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=1091\text{G} = 10^9

    10. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      The EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let tEXt_{EX} denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of tEXt_{EX} and M (the number of instructions of that type in a sequence of 100 instructions for a program P), are given in the table below. The duration of the pipeline clock cycle is 1 nanosecond. Assume that the latch time for the interstage buffers in the pipeline is negligible.

      | Instruction | tEXt_{EX} in nanoseconds | MM |
      |---|---|---|
      | LOAD | 1.8 | 15 |
      | IMUL | 1.5 | 10 |
      | IDIV | 2.5 | 5 |
      | FADD | 1.7 | 10 |
      | FSUB | 1.7 | 5 |
      | FMUL | 2.8 | 15 |
      | FDIV | 3.2 | 5 |
      | All other instructions | Less than 1.0 | 35 |

      When program P is executed, the number of clock cycles for which the pipeline is stalled due to structural hazards in the EX stage is ______. (*answer in integer*)

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Suppose a program is running on a non-pipelined single processor computer system. The computer is connected to an external device that can interrupt the processor asynchronously. The processor needs to execute the interrupt service routine (ISR) to serve this interrupt. The following steps (not necessarily in order) are taken by the processor when the interrupt arrives: (i) The processor saves the content of the program counter. (ii) The program counter is loaded with the start address of the ISR. (iii) The processor finishes the present instruction. Which ONE of the following is the CORRECT sequence of steps?

      1. (a) (iii), (i), (ii)
      2. (b) (i), (iii), (ii)
      3. (c) (i), (ii), (iii)
      4. (d) (iii), (ii), (i)
      Show answer

      (a) (iii), (i), (ii)

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A partial data path of a processor is given in the figure, where RA, RB, and RZ are 32-bit registers. Which option(s) is/are CORRECT related to arithmetic operations using the data path as shown?

      1. (a) The data path can implement arithmetic operations involving two registers.
      2. (b) The data path can implement arithmetic operations involving one register and one immediate value.
      3. (c) The data path can implement arithmetic operations involving two immediate values.
      4. (d) The data path can only implement arithmetic operations involving one register and one immediate value.
      Show answer

      ()

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following is/are part of an Instruction Set Architecture of a processor?

      1. (a) The size of the cache memory
      2. (b) The clock frequency of the processor
      3. (c) The number of cache memory levels
      4. (d) The total number of registers
      Show answer

      (d) The total number of registers

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, 1K=2101\text{K} = 2^{10}, 1M=2201\text{M} = 2^{20}.]

      1. (a) 6×2106 \times 2^{10}
      2. (b) 8×2108 \times 2^{10}
      3. (c) 2122^{12}
      4. (d) 2142^{14}
      Show answer

      (a) 6×2106 \times 2^{10}

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A processor has 64 general-purpose registers and 50 distinct instruction types. An instruction is encoded in 32-bits. What is the maximum number of bits that can be used to store the immediate operand for the given instruction? ``` ADD R1, #25 // R1 = R1 + 25 ```

      1. (a) 16
      2. (b) 20
      3. (c) 22
      4. (d) 24
      Show answer

      (b) 20

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block. Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?

      1. (a) 64 KB and 4 KB
      2. (b) 128 KB and 16 KB
      3. (c) 64 KB and 8 KB
      4. (d) 128 KB and 6 KB
      Show answer

      (a) 64 KB and 4 KB

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A computer has a memory hierarchy consisting of two-level cache (L1 and L2) and a main memory. If the processor needs to access data from memory, it first looks into L1 cache. If the data is not found in L1 cache, it goes to L2 cache. If it fails to get the data from L2 cache, it goes to main memory, where the data is definitely available. *Hit rates* and *access times* of various memory units are shown in the figure. The *average memory access time* in nanoseconds (nsns) is ________. (rounded off to two decimal places)

      Processor → L1 cache (Hit rate=95%, Access time = 10 ns) → L2 cache (Hit rate=85%, Access time (including L1 cache miss penalty) = 20 ns) → Main Memory (Access time (including L1 and L2 cache miss penalty) = 200 ns)

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Given a computing system with two levels of cache (L1 and L2) and a main memory. The first level (L1) cache access time is 1 nanosecond (ns) and the “hit rate” for L1 cache is 90% while the processor is accessing the data from L1 cache. Whereas, for the second level (L2) cache, the “hit rate” is 80% and the “miss penalty” for transferring data from L2 cache to L1 cache is 10 ns. The “miss penalty” for the data to be transferred from main memory to L2 cache is 100 ns. Then the average memory access time in this system in nanoseconds is ___________ . (rounded off to one decimal place)

    19. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A 5-stage instruction pipeline has stage delays of 180, 250, 150, 170, and 250, respectively, in nanoseconds. The delay of an inter-stage latch is 10 nanoseconds. Assume that there are no pipeline stalls due to branches and other hazards. The time taken to process 1000 instructions in microseconds is __________ . (rounded off to two decimal places)

    20. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      An application executes 6.4×1086.4 \times 10^{8} number of instructions in 6.3 seconds. There are four types of instructions, the details of which are given in the table. The duration of a clock cycle in nanoseconds is _________. (rounded off to one decimal place)

      | Instruction type | Clock cycles required per instruction (CPI) | Number of instructions executed |
      |---|---|---|
      | Branch | 2 | 2.25×1082.25 \times 10^{8} |
      | Load | 5 | 1.20×1081.20 \times 10^{8} |
      | Store | 4 | 1.65×1081.65 \times 10^{8} |
      | Arithmetic | 3 | 1.30×1081.30 \times 10^{8} |

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider a computer with a 4 MHz processor. Its DMA controller can transfer 8 bytes in 1 cycle from a device to main memory through cycle stealing at regular intervals. Which one of the following is the data transfer rate (in bits per second) of the DMA controller if 1% of the processor cycles are used for DMA?

      1. (a) 2,56,000
      2. (b) 3,200
      3. (c) 25,60,000
      4. (d) 32,000
      Show answer

      (c) 25,60,000

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which one of the following statements is FALSE?

      1. (a) In the cycle stealing mode of DMA, one word of data is transferred between an I/O device and main memory in a stolen cycle
      2. (b) For bulk data transfer, the burst mode of DMA has a higher throughput than the cycle stealing mode
      3. (c) Programmed I/O mechanism has a better CPU utilization than the interrupt driven I/O mechanism
      4. (d) The CPU can start executing an interrupt service routine faster with vectored interrupts than with non-vectored interrupts
      Show answer

      (c) Programmed I/O mechanism has a better CPU utilization than the interrupt driven I/O mechanism

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider a 5-stage pipelined processor with Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Register Writeback (WB) stages. Which of the following statements about forwarding is/are CORRECT?

      1. (a) In a pipelined execution, forwarding means the result from a source stage of an earlier instruction is passed on to the destination stage of a later instruction
      2. (b) In forwarding, data from the output of the MEM stage can be passed on to the input of the EX stage of the next instruction
      3. (c) Forwarding cannot prevent all pipeline stalls
      4. (d) Forwarding does not require any extra hardware to retrieve the data from the pipeline stages
      Show answer

      ()

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      An instruction format has the following structure: Instruction Number: Opcode destination reg, source reg-1, source reg-2 Consider the following sequence of instructions to be executed in a pipelined processor: ``` I1: DIV R3, R1, R2 I2: SUB R5, R3, R4 I3: ADD R3, R5, R6 I4: MUL R7, R3, R8 ``` Which of the following statements is/are TRUE?

      1. (a) There is a RAW dependency on R3 between I1 and I2
      2. (b) There is a WAR dependency on R3 between I1 and I3
      3. (c) There is a RAW dependency on R3 between I2 and I3
      4. (d) There is a WAW dependency on R3 between I3 and I4
      Show answer

      (a) There is a RAW dependency on R3 between I1 and I2

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider two set-associative cache memory architectures: WBC, which uses the write back policy, and WTC, which uses the write through policy. Both of them use the LRU (Least Recently Used) block replacement policy. The cache memory is connected to the main memory. Which of the following statements is/are TRUE?

      1. (a) A read miss in WBC never evicts a dirty block
      2. (b) A read miss in WTC never triggers a write back operation of a cache block to main memory
      3. (c) A write hit in WBC can modify the value of the dirty bit of a cache block
      4. (d) A write miss in WTC always writes the victim cache block to main memory before loading the missed block to the cache
      Show answer

      ()

    26. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The baseline execution time of a program on a 2 GHz single core machine is 100 nanoseconds (ns). The code corresponding to 90% of the execution time can be fully parallelized. The overhead for using an additional core is 10 ns when running on a multicore system. Assume that all cores in the multicore system run their share of the parallelized code for an equal amount of time. The number of cores that minimize the execution time of the program is ________

    27. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A given program has 25% load/store instructions. Suppose the ideal CPI (cycles per instruction) without any memory stalls is 2. The program exhibits 2% miss rate on instruction cache and 8% miss rate on data cache. The miss penalty is 100 cycles. The speedup (rounded off to two decimal places) achieved with a perfect cache (i.e., with NO data or instruction cache misses) is _________

    28. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A processor with 16 general purpose registers uses a 32-bit instruction format. The instruction format consists of an opcode field, an addressing mode field, two register operand fields, and a 16-bit scalar field. If 8 addressing modes are to be supported, the maximum number of unique opcodes possible for every addressing mode is _________

    29. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A non-pipelined instruction execution unit operating at 2 GHz takes an average of 6 cycles to execute an instruction of a program P. The unit is then redesigned to operate on a 5-stage pipeline at 2 GHz. Assume that the ideal throughput of the pipelined unit is 1 instruction per cycle. In the execution of program P, 20% instructions incur an average of 2 cycles stall due to data hazards and 20% instructions incur an average of 3 cycles stall due to control hazards. The speedup (*rounded off to one decimal place*) obtained by the pipelined design over the non-pipelined design is _________

    30. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA of the processor has 150 distinct instructions. The instructions are equally divided into two types, namely R-type and I-type, whose formats are shown below.

      R-type Instruction Format:

      | OPCODE | UNUSED | DST Register | SRC Register1 | SRC Register 2 |
      |---|---|---|---|---|

      I-type Instruction Format:

      | OPCODE | DST Register | SRC Register | # Immediate value/address |
      |---|---|---|---|

      In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.

      Let XX be the number of bits used to encode the UNUSED field, YY be the number of bits used to encode the OPCODE field, and ZZ be the number of bits used to encode the immediate value/address field. The value of X+2Y+ZX + 2Y + Z is ________

    31. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider a 3-stage pipelined processor having a delay of 10 ns (nanoseconds), 20 ns, and 14 ns, for the first, second, and the third stages, respectively. Assume that there is no other delay and the processor does not suffer from any pipeline hazards. Also assume that one instruction is fetched every cycle. The total execution time for executing 100 instructions on this processor is ____________ ns.

    32. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A keyboard connected to a computer is used at a rate of 1 keystroke per second. The computer system polls the keyboard every 10 ms (milli seconds) to check for a keystroke and consumes 100 $\mu$s (micro seconds) for each poll. If it is determined after polling that a key has been pressed, the system consumes an additional 200 $\mu$s to process the keystroke. Let T1T_1 denote the fraction of a second spent in polling and processing a keystroke.

      In an alternative implementation, the system uses interrupts instead of polling. An interrupt is raised for every keystroke. It takes a total of 1 ms for servicing an interrupt and processing a keystroke. Let T2T_2 denote the fraction of a second spent in servicing the interrupt and processing a keystroke.

      The ratio T1T2\dfrac{T_1}{T_2} is ____________. (Rounded off to one decimal place)

    33. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the given C-code and its corresponding assembly code, with a few operands U1–U4 being unknown. Some useful information as well as the semantics of each unique assembly instruction is annotated as inline comments in the code. The memory is byte-addressable. ```c //C-code int a[10], b[10], i; // int is 32-bit for (i=0; i<10;i++) a[i] = b[i] * 8; ``` ``` ;assembly-code (; indicates comments) ;r1-r5 are 32-bit integer registers ;initialize r1=0, r2=10 ;initialize r3, r4 with base address of a, b L01: jeq r1, r2, end ;if(r1==r2) goto end L02: lw r5, 0(r4) ;r5 <- Memory[r4+0] L03: shl r5, r5, U1 ;r5 <- r5 << U1 L04: sw r5, 0(r3) ;Memory[r3+0] <- r5 L05: add r3, r3, U2 ;r3 <- r3+U2 L06: add r4, r4, U3 L07: add r1, r1, 1 L08: jmp U4 ;goto U4 L09: end ``` Which one of the following options is a CORRECT replacement for operands in the position (U1, U2, U3, U4) in the above assembly code?

      1. (a) (8, 4, 1, L02)
      2. (b) (3, 4, 4, L01)
      3. (c) (8, 1, 1, L02)
      4. (d) (3, 1, 1, L01)
      Show answer

      (b) (3, 4, 4, L01)

    34. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      An 8-way set associative cache of size 64 KB (1 KB = 1024 bytes) is used in a system with 32-bit address. The address is sub-divided into TAG, INDEX, and BLOCK OFFSET. The number of bits in the TAG is ____________.

    35. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      1. (a) DMA based I/O transfer
      2. (b) Interrupt driven I/O transfer
      3. (c) Polling based I/O transfer
      4. (d) Programmed I/O transfer
      Show answer

      (a) DMA based I/O transfer

    36. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let WB and WT be two set associative cache organizations that use LRU algorithm for cache block replacement. WB is a write back cache and WT is a write through cache. Which of the following statements is/are FALSE?

      1. (a) Each cache block in WB and WT has a dirty bit.
      2. (b) Every write hit in WB leads to a data transfer from cache to main memory.
      3. (c) Eviction of a block from WT will not lead to data transfer from cache to main memory.
      4. (d) A read miss in WB will never lead to eviction of a dirty block from WB.
      Show answer

      ()

    37. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A cache memory that has a hit rate of 0.8 has an access latency 10 ns and miss penalty 100 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 15 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 _____________.

    38. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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 P, Q, R, and S 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 P, Q, R, and S 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?

      1. (a) Every access to S is a hit.
      2. (b) Once P is brought to the cache it is never evicted.
      3. (c) At the end of the execution only R and S reside in the cache.
      4. (d) Every access to R evicts Q from the cache.
      Show answer

      ()

    39. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A processor X1X_1 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 P that has 30% branch instructions, control hazards incur 2 cycles stall for every branch. A new version of the processor X2X_2 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 X1X_1 and X2X_2. If the BPU has a prediction accuracy of 80%, the speed up (*rounded off to two decimal places*) obtained by X2X_2 over X1X_1 in executing P is____________.

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider a set-associative cache of size 2KB (1KB =210= 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 __________.

    41. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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.

    42. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      The size of the tag field is ______ bits.

    43. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

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

      S2S_2: 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) S1S_1 is true and S2S_2 is false
      2. (b) S1S_1 is false and S2S_2 is true
      3. (c) S1S_1 is true and S2S_2 is true
      4. (d) S1S_1 is false and S2S_2 is false
      Show answer

      (a) S1S_1 is true and S2S_2 is false

    44. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A five-stage pipeline has stage delays of 150, 120, 150, 160 and 140 nanoseconds. The registers that are used between the pipeline stages have a delay of 5 nanoseconds each. The total time to execute 100 independent instructions on this pipeline, assuming there are no pipeline stalls, is ______ nanoseconds.

    45. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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

      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* is defined as follows:



      Speedup=Execution time without operand forwardingExecution time with operand forwarding\mathit{Speedup} = \frac{\text{Execution time without operand forwarding}}{\text{Execution time with operand forwarding}}




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

    46. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following instruction sequence where registers R1, R2 and R3 are general purpose and MEMORY[X] denotes the content at the memory location X. | Instruction | Semantics | Instruction Size (bytes) | |---|---|---| | MOV R1, (5000) | R1 ← MEMORY[5000] | 4 | | MOV R2, (R3) | R2 ← MEMORY[R3] | 4 | | ADD R2, R1 | R2 ← R1+R2 | 2 | | MOV (R3), R2 | MEMORY[R3] ← R2 | 4 | | INC R3 | R3 ← R3+1 | 2 | | DEC R1 | R1 ← R1-1 | 2 | | BNZ 1004 | Branch if not zero to the given absolute address | 2 | | HALT | Stop | 1 | Assume that the content of the memory location 5000 is 10, and the content of the register R3 is 3000. The content of each of the memory locations from 3000 to 3010 is 50. The instruction sequence starts from the memory location 1000. All the numbers are in decimal format. Assume that the memory is byte addressable. After the execution of the program, the content of memory location 3010 is ______.

    47. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following statements. I. Daisy chaining is used to assign priorities in attending interrupts. II. When a device raises a vectored interrupt, the CPU does polling to identify the source of interrupt. III. In polling, the CPU periodically checks the status bits to know if any device needs its attention. IV. During DMA, both the CPU and DMA controller can be bus masters at the same time. Which of the above statements is/are TRUE?

      1. (a) I and II only
      2. (b) I and IV only
      3. (c) I and III only
      4. (d) III only
      Show answer

      (c) I and III only

    48. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following data path diagram.

      Consider an instruction: R0 ←\leftarrow R1 + R2. The following steps are used to execute it over the given data path. Assume that PC is incremented appropriately. The subscripts r and w indicate read and write operations, respectively.

      1. R2r\mathrm{R2}_{r}, TEMP1r\mathrm{TEMP1}_{r}, ALUadd\mathrm{ALU}_{\mathit{add}}, TEMP2w\mathrm{TEMP2}_{w}
      2. R1r\mathrm{R1}_{r}, TEMP1w\mathrm{TEMP1}_{w}
      3. PCr\mathrm{PC}_{r}, MARw\mathrm{MAR}_{w}, MEMr\mathrm{MEM}_{r}
      4. TEMP2r\mathrm{TEMP2}_{r}, R0w\mathrm{R0}_{w}
      5. MDRr\mathrm{MDR}_{r}, IRw\mathrm{IR}_{w}

      Which one of the following is the correct order of execution of the above steps?

      1. (a) 2, 1, 4, 5, 3
      2. (b) 1, 2, 4, 3, 5
      3. (c) 3, 5, 2, 1, 4
      4. (d) 3, 5, 1, 2, 4
      Show answer

      (c) 3, 5, 2, 1, 4

    49. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A direct mapped cache memory of 1 MB has a block size of 256 bytes. The cache has an access time of 3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory access time in ns (round off to 1 decimal place) is \_\_\_\_\_\_\_.

    50. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A computer system with a word length of 32 bits has a 16 MB byte-addressable main memory and a 64 KB, 4-way set associative cache memory with a block size of 256 bytes. Consider the following four physical addresses represented in hexadecimal notation. A1 = 0x42C8A4, A2 = 0x546888, A3 = 0x6A289C, A4 = 0x5E4880 Which one of the following is TRUE?

      1. (a) A1 and A4 are mapped to different cache sets.
      2. (b) A2 and A3 are mapped to the same cache set.
      3. (c) A3 and A4 are mapped to the same cache set.
      4. (d) A1 and A3 are mapped to the same cache set.
      Show answer

      (b) A2 and A3 are mapped to the same cache set.

    51. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a non-pipelined processor operating at 2.5 GHz. It takes 5 clock cycles to complete an instruction. You are going to make a 5-stage pipeline out of this processor. Overheads associated with pipelining force you to operate the pipelined processor at 2 GHz. In a given program, assume that 30% are memory instructions, 60% are ALU instructions and the rest are branch instructions. 5% of the memory instructions cause stalls of 50 clock cycles each due to cache misses and 50% of the branch instructions cause stalls of 2 cycles each. Assume that there are no stalls associated with the execution of ALU instructions. For this program, the speedup achieved by the pipelined processor over the non-pipelined processor (round off to 2 decimal places) is \_\_\_\_\_\_.

    52. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is \_\_\_\_\_\_\_.

    53. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A certain processor uses a fully associative cache of size 16 kB. The cache block size is 16 bytes. Assume that the main memory is byte addressable and uses a 32-bit address. How many bits are required for the *Tag* and the *Index* fields respectively in the addresses generated by the processor?

      1. (a) 24 bits and 0 bits
      2. (b) 28 bits and 4 bits
      3. (c) 24 bits and 4 bits
      4. (d) 28 bits and 0 bits
      Show answer

      (d) 28 bits and 0 bits

    54. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A certain processor deploys a single-level cache. The cache block size is 8 words and the word size is 4 bytes. The memory system uses a 60-MHz clock. To service a cache miss, the memory controller first takes 1 cycle to accept the starting address of the block, it then takes 3 cycles to fetch all the eight words of the block, and finally transmits the words of the requested block at the rate of 1 word per cycle. The maximum bandwidth for the memory system when the program running on the processor issues a series of read operations is _________ ×106\times 10^6 bytes/sec.

  4. 07Programming in C4 ch · 1 h 1 min38 PYQ
    1. Basics, data types and operators 16′
    2. Control flow, functions and recursion 14′
    3. Arrays, strings and pointers 16′
    4. Structures, unions, files and memory 15′
    See the 38 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      Consider the following three ANSI-C programs, P1, P2, and P3. P1 ```c #include <stdio.h> int a=5; int main(){ int a=7; return(0); } ``` P2 ```c #include <stdio.h> int main(){ int a=5; int a=7; return(0); } ``` P3 ```c #include <stdio.h> int main(){ int a=5; float a=7; return(0); } ``` Which one of the following statements is true?

      1. (a) Only P1 will compile without any error
      2. (b) Only P2 will compile without any error
      3. (c) Only P3 will compile without any error
      4. (d) All three programs P1, P2, and P3 will compile without any error
      Show answer

      (a) Only P1 will compile without any error

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the following program in C: ```c #include <stdio.h> void func(int i, int j) { if(i < j) { int i = 0; while (i < 10) { j += 2; i++; } } printf("%d", i); } int main() { int i = 9, j = 10; func(i, j); return 0; } ``` The output of the program is _________. (*answer in integer*) *Note*: Assume that the program compiles and runs successfully.

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      Consider the following ANSI-C program. ```c #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.

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the recursive functions represented by the following code segment: ```c int bar(int n){ if (n == 1) return 0; else return 1 + bar(n/2); } int foo(int n){ if (n == 1) return 1; else return 1 + foo(bar(n)); } ``` The smallest positive integer `n` for which `foo(n)` returns 5 is ______. (*answer in integer*) *Note*: Ignore syntax errors (if any) in the function.

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      Consider the following ANSI-C function. ```c 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.

    6. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following C program: ```c #include <stdio.h> void stringcopy(char *, char *); int main(){ char a[30] = "@#Hello World!"; stringcopy(a, a + 2); printf("%s\n", a); return 0; } void stringcopy(char *s, char *t) { while(*t) *s++ = *t++; } ``` Which ONE of the following will be the output of the program?

      1. (a) `@#Hello World!`
      2. (b) `Hello World!`
      3. (c) `ello World!`
      4. (d) `Hello World!d!`
      Show answer

      (d) `Hello World!d!`

    7. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      ```c int x=126,y=105; do { if(x>y) x=x-y; else y=y-x; } while(x!=y); printf("%d",x); ``` The output of the given C code segment is ________. (Answer in integer)

    8. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      ``` #include <stdio.h> void foo(int *p, int x){ *p=x; } int main(){ int *z; int a = 20, b = 25; z = &a; foo(z,b); printf("%d",a); return 0; } ``` The output of the given C program is __________. (Answer in integer)

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      ``` #include <stdio.h> int foo(int S[],int size){ if(size == 0) return 0; if(size == 1) return 1; if(S[0] != S[1]) return 1+foo(S+1,size-1); return foo(S+1,size-1); } int main(){ int A[]={0,1,2,2,2,0,0,1,1}; printf("%d",foo(A,9)); return 0; } ``` The value printed by the given C program is _______ . (Answer in integer)

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following C program: ```c #include <stdio.h> int main(){ int a; int arr[5] = {30,50,10}; int *ptr; ptr = &arr[0] + 1; a = *ptr; (*ptr)++; ptr++; printf("%d", a + (*ptr) + arr[1]); return 0; } ``` The output of the above program is ___________. (Answer in integer)

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following C program: ``` #include <stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t *= 10; t /=10; while (t>0) { d = n/t; n = n%t; t /= 10; if (turn) newnum = 10*newnum + d; turn = (turn + 1) % 2; } return newnum; } int main () { printf ("%d", gate(14362)); return 0; } ``` The value printed by the given C program is _______ . (Answer in integer)

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following C program: ```c #include <stdio.h> int g(int n) { return (n+10); } int f(int n) { return g(n*2); } int main() { int sum, n; sum=0; for (n=1; n<3; n++) sum += g(f(n)); printf ("%d", sum); return 0; } ``` The output of the given C program is ________. (Answer in integer)

    13. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following C program. Assume parameters to a function are evaluated from right to left. ``` #include <stdio.h> int g(int p) { printf("%d", p); return p; } int h(int q) { printf("%d", q); return q; } void f(int x, int y) { g(x); h(y); } int main() { f(g(10),h(20)); } ``` Which one of the following options is the CORRECT output of the above C program?

      1. (a) 20101020
      2. (b) 10202010
      3. (c) 20102010
      4. (d) 10201020
      Show answer

      (a) 20101020

    14. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following C program: ``` #include <stdio.h> int main(){ int a = 6; int b = 0; while(a < 10) { a = a / 12 + 1; a += b;} printf(”%d”, a); return 0;} ``` Which one of the following statements is CORRECT?

      1. (a) The program prints 9 as output
      2. (b) The program prints 10 as output
      3. (c) The program gets stuck in an infinite loop
      4. (d) The program prints 6 as output
      Show answer

      (c) The program gets stuck in an infinite loop

    15. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following C program: ``` #include <stdio.h> void fX(); int main(){ fX(); return 0;} void fX(){ char a; if((a=getchar()) != ’\n’) fX(); if(a != ’\n’) putchar(a);} ``` Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the following statements is CORRECT?

      1. (a) The program will not terminate
      2. (b) The program will terminate with no output
      3. (c) The program will terminate with 4321 as output
      4. (d) The program will terminate with 1234 as output
      Show answer

      (c) The program will terminate with 4321 as output

    16. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the operator precedence and associativity rules for the *integer* arithmetic operators given in the table below.

      | Operator | Precedence | Associativity |
      |---|---|---|
      | ++ | Highest | Left |
      | −- | High | Right |
      | ∗* | Medium | Right |
      | // | Low | Right |

      The value of the expression 3+1+5∗2/7+2−4−7−6/23 + 1 + 5 * 2 / 7 + 2 - 4 - 7 - 6 / 2 as per the above rules is __________

    17. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following C function definition. ``` int fX(char *a){ char *b = a; while(*b) b++; return b - a;} ``` Which of the following statements is/are TRUE?

      1. (a) The function call fX(”abcd”) will always return a value
      2. (b) Assuming a character array c is declared as char c[] = ”abcd” in main(), the function call fX(c)will always return a value
      3. (c) The code of the function will not compile
      4. (d) Assuming a character pointer c is declared as char *c = ”abcd” in main(), the function call fX(c)will always return a value
      Show answer

      ()

    18. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      What is the output of the following C program? ``` #include <stdio.h> int main() { double a[2]={20.0, 25.0}, *p, *q; p = a; q = p + 1; printf(”%d,%d”, (int)(q – p), (int)(*q – *p)); return 0;} ```

      1. (a) 4,8
      2. (b) 1,5
      3. (c) 8,5
      4. (d) 1,8
      Show answer

      (b) 1,5

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following C function definition. ``` int f(int x, int y) { for (int i=0; i<y; i++) { x=x+x+y; } return x; } ``` Which of the following statements is/are TRUE about the above function?

      1. (a) If the inputs are x=20, y=10, then the return value is greater than 2202^{20}
      2. (b) If the inputs are x=20, y=20, then the return value is greater than 2202^{20}
      3. (c) If the inputs are x=20, y=10, then the return value is less than 2102^{10}
      4. (d) If the inputs are x=10, y=20, then the return value is greater than 2202^{20}
      Show answer

      ()

    20. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The integer value printed by the ANSI-C program given below is ____________. ```c #include<stdio.h> int funcp(){ static int x = 1; x++; return x; } int main(){ int x,y; x = funcp(); y = funcp()+x; printf("%d\n", (x+y)); return 0; } ```

    21. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      What is printed by the following ANSI C program? ```c #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; } ```

      1. (a) 1, 10, 11
      2. (b) 1, 10, 14
      3. (c) 10, 14, 11
      4. (d) 10, 10, 14
      Show answer

      (d) 10, 10, 14

    22. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      What is printed by the following ANSI C program? ```c #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; } ```

      1. (a) ``` 1 2 3 10 11 12 19 20 21 ```
      2. (b) ``` 1 4 7 10 13 16 19 22 25 ```
      3. (c) ``` 1 2 3 4 5 6 7 8 9 ```
      4. (d) ``` 1 2 3 13 14 15 25 26 27 ```
      Show answer

      (a) ``` 1 2 3 10 11 12 19 20 21 ```

    23. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      What is printed by the following ANSI C program? ```c #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 | B | C | ... | Z | |---|---|---|---|---| | 65 | 66 | 67 | ... | 90 | | a | b | c | ... | z | |---|---|---|---|---| | 97 | 98 | 99 | ... | 122 | | * | + | − | |---|---|---| | 42 | 43 | 45 |

      1. (a) z K S
      2. (b) 122 75 83
      3. (c) * - +
      4. (d) P x +
      Show answer

      (a) z K S

    24. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

      (c) 24

    25. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

    26. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

      (d) It dereferences an uninitialized pointer that may result in a run-time error.

    27. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following ANSI C program. ```c #include <stdio.h> int main() { int i, j, count; count = 0; i = 0; for (j = -3; j <= 3; j++) { if ((j >= 0) && (i++)) count = count + j; } count = count + i; printf("%d", count); return 0; } ``` Which one of the following options is correct?

      1. (a) The program will not compile successfully.
      2. (b) The program will compile successfully and output 10 when executed.
      3. (c) The program will compile successfully and output 8 when executed.
      4. (d) The program will compile successfully and output 13 when executed.
      Show answer

      (b) The program will compile successfully and output 10 when executed.

    28. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following ANSI C function:

      ```c
      int SimpleFunction(int Y[], int n, int x)
      {
      int total = Y[0], loopIndex;
      for (loopIndex = 1; loopIndex <= n - 1; loopIndex++)
      total = x * total + Y[loopIndex];
      return total;
      }
      ```

      Let Z be an array of 10 elements with Z[ii]=1, for all ii such that 0≤i≤90 \le i \le 9. The value returned by SimpleFunction(Z, 10, 2) is ______.

    29. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

    30. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following C program. ```c #include <stdio.h> int main() { int a[4][5]={{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18 , 19, 20}}; printf("%d\n", *(*(a+**a+2)+3)); return(0); } ``` The output of the program is \_\_\_\_\_\_\_.

    31. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following C functions. ```c int fun1(int n) { static int i = 0; if (n > 0) { ++i; fun1(n-1); } return(i); } ``` ```c int fun2(int n) { static int i = 0; if (n > 0) { i = i + fun1(n); fun2(n-1); } return(i); } ``` The return value of `fun2(5)` is \_\_\_\_\_\_\_\_.

    32. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following C functions. ```c int tob(int b, int* arr){ int i; for(i=0; b>0; i++){ if(b%2) arr[i]=1; else arr[i]=0; b = b/2; } return(i); } ``` ```c int pp(int a,int b) { int arr[20]; int i, tot = 1, ex, len; ex = a; len = tob(b,arr); for(i=0; i<len; i++){ if(arr[i]==1) tot = tot * ex; ex = ex * ex; } return(tot); } ``` The value returned by `pp(3,4)` is \_\_\_\_\_\_\_\_\_\_.

    33. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following C program: ```c #include <stdio.h> int jumble(int x, int y){ x=2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n", x); return 0; } ``` The value printed by the program is ________.

    34. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following C program: ```c #include <stdio.h> int main(){ int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip=arr+4; printf("%d\n", ip[1]); return 0; } ``` The number that will be displayed on execution of the program is__________ .

    35. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following C function. ```c void convert(int n){ if(n<0) printf("%d",n); else { convert(n/2); printf("%d",n%2); } } ``` Which one of the following will happen when the function `convert` is called with any positive integer `n` as argument?

      1. (a) It will print the binary representation of `n` and terminate
      2. (b) It will print the binary representation of `n` in the reverse order and terminate
      3. (c) It will print the binary representation of `n` but will not terminate
      4. (d) It will not print anything and will not terminate
      Show answer

      (d) It will not print anything and will not terminate

    36. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following C program: ```c #include <stdio.h> int r(){ static int num=7; return num--; } int main(){ for (r();r();r()) printf("%d",r()); return 0; } ``` Which one of the following values will be displayed on execution of the programs?

      1. (a) 41
      2. (b) 52
      3. (c) 63
      4. (d) 630
      Show answer

      (b) 52

    37. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following C program: ```c #include <stdio.h> int main(){ float sum = 0.0, j = 1.0, i = 2.0; while (i/j > 0.0625){ j = j + j; sum = sum + i/j; printf("%f\n", sum); } return 0; } ``` The number of times the variable `sum` will be printed, when the above program is executed, is _______________.

    38. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following C program: ```c #include <stdio.h> int main() { int a[] = {2, 4, 6, 8, 10}; int i, sum = 0, *b = a + 4; for (i = 0; i < 5; i++) sum = sum + (*b - i) - *(b - i); printf ("%d\n", sum); return 0; } ``` The output of the above C program is __________.

  5. 08Data structures5 ch · 1 h 22 min47 PYQ
    1. Arrays, stacks and queues 18′
    2. Linked lists 15′
    3. Trees, binary search trees and binary heaps 18′
    4. Hashing 14′
    5. Graphs and their representation 17′
    See the 47 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      The set T represents various traversals over binary tree. The set S represents the order of visiting nodes during a traversal. | T | S | |---|---| | I: Inorder | L: left subtree, node, right subtree | | II: Preorder | M: node, left subtree, right subtree | | III: Postorder | N: left subtree, right subtree, node | Which one of the following is the correct match from T to S ?

      1. (a) I – L, II – M, III – N
      2. (b) I – M, II – L, III – N
      3. (c) I – N, II – M, III – L
      4. (d) I – L, II – N, III – M
      Show answer

      (a) I – L, II – M, III – N

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Let nn be an odd number greater than 100. Consider a binary minheap with nn elements stored in an array PP whose index starts from 1.

      Which of the following indices of PP do/does NOT correspond to any leaf node of the minheap?

      1. (a) n+12\dfrac{n+1}{2}
      2. (b) n−12\dfrac{n-1}{2}
      3. (c) n−32\dfrac{n-3}{2}
      4. (d) nn
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider a hash table P[0,1,…,10]P[0, 1, \ldots, 10] that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function used is h(x)=(x+7) mod 11h(x) = (x + 7) \bmod 11.

      Consider the following sequence of insertions performed on PP:

      1, 13, 22, 15, 11, 24

      Which of the following positions in the hash table is/are empty after these insertions are performed?

      1. (a) 0
      2. (b) 10
      3. (c) 2
      4. (d) 1
      Show answer

      (c) 2

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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)

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with 23 nodes is _________. (*answer in integer*)

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list pointed to by the pointer variable `head`. ```c struct node{ int elt; struct node *next; }; int getListSize (struct node *head) { if( E1 ) return 1; return E2; } ``` Which one of the following options gives the correct replacements for the expressions **E1** and **E2**?

      1. (a) **E1**: `head == NULL` **E2**: `1 + getListSize(head)`
      2. (b) **E1**: `head->next == NULL` **E2**: `1 + getListSize(head->next)`
      3. (c) **E1**: `head == NULL` **E2**: `1 + getListSize(head->next)`
      4. (d) **E1**: `head->next == NULL` **E2**: `1 + getListSize(head)`
      Show answer

      (b) **E1**: `head->next == NULL` **E2**: `1 + getListSize(head->next)`

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let PP be the set of all integers from 1 to 15. Consider any order of insertion of the elements of PP into a binary search tree that creates a complete binary tree.

      Which one of the following elements can NEVER be the third element that is inserted?

      1. (a) 4
      2. (b) 2
      3. (c) 10
      4. (d) 5
      Show answer

      (d) 5

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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)\mathit{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)\mathit{Suc}(V) denote the node that is its inorder successor. If a node VV does not have an inorder successor, then Suc(V)\mathit{Suc}(V) is NULL\mathit{NULL}. As there are no duplicates, if Suc(V)\mathit{Suc}(V) is not NULL\mathit{NULL}, then Val(V)<Val(Suc(V))\mathit{Val}(V) < \mathit{Val}(\mathit{Suc}(V)).

      Corresponding to every leaf node LiL_i that has a non-NULL Suc(Li)\mathit{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))\mathit{Val}(L_i) < k_i < \mathit{Val}(\mathit{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?

      1. (a) KK cannot have any duplicates
      2. (b) KK will have at least one element
      3. (c) After inserting all keys from KK, the height of the BST can increase at most by one
      4. (d) Number of nodes in the BST will double after inserting all keys from KK
      Show answer

      ()

    9. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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 S 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 .

      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 xSxS denotes that element xx was assigned to SS and yQyQ denotes that element yy was assigned to QQ.

      1. (a) 1S,2Q,3S,4S,5Q1S, 2Q, 3S, 4S, 5Q
      2. (b) 1Q,2Q,3S,4S,5Q1Q, 2Q, 3S, 4S, 5Q
      3. (c) 1Q,2Q,3Q,4S,5S1Q, 2Q, 3Q, 4S, 5S
      4. (d) 1S,2S,3S,4Q,5Q1S, 2S, 3S, 4Q, 5Q
      Show answer

      ()

    10. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      The following sequence corresponds to the preorder traversal of a binary search tree TT:

      50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77

      The position of the element 60 in the postorder traversal of TT is ______. (*answer in integer*)

      *Note:* The position begins with 1.

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider a binary tree TT in which every node has either zero or two children. Let n>0n > 0 be the number of nodes in TT.

      Which ONE of the following is the number of nodes in TT that have exactly two children?

      1. (a) n−22\dfrac{n-2}{2}
      2. (b) n−12\dfrac{n-1}{2}
      3. (c) n2\dfrac{n}{2}
      4. (d) n+12\dfrac{n+1}{2}
      Show answer

      (b) n−12\dfrac{n-1}{2}

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following statement(s) is/are TRUE for any binary search tree (BST) having nn distinct integers?

      1. (a) The maximum length of a path from the root node to any other node is (n−1)(n - 1).
      2. (b) An inorder traversal will always produce a sorted sequence of elements.
      3. (c) Finding an element takes O(log⁡2n)O(\log_2 n) time in the worst case.
      4. (d) Every BST is also a Min-Heap.
      Show answer

      ()

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node.

      Suppose a Min-Heap TT stores 32 keys. The height of TT is _____________. (Answer in integer)

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Suppose the values 10,−4,15,30,20,5,60,1910, -4, 15, 30, 20, 5, 60, 19 are inserted in that order into an initially empty binary search tree. Let TT be the resulting binary search tree. The number of edges in the path from the node containing 19 to the root node of TT is ___________. (Answer in integer)

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:

      P: Unsorted doubly linked list with pointers to the head node and tail node of the list.

      Q: Min-heap implemented using an array.

      R: Binary Search Tree.

      Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size nn of these data structures?

      1. (a) P: Θ(1)\Theta(1), Q: Θ(n)\Theta(n), R: Θ(n)\Theta(n)
      2. (b) P: Θ(1)\Theta(1), Q: Θ(nlog⁡n)\Theta(n \log n), R: Θ(n)\Theta(n)
      3. (c) P: Θ(n)\Theta(n), Q: Θ(nlog⁡n)\Theta(n \log n), R: Θ(n2)\Theta(n^{2})
      4. (d) P: Θ(1)\Theta(1), Q: Θ(n)\Theta(n), R: Θ(nlog⁡n)\Theta(n \log n)
      Show answer

      (a) P: Θ(1)\Theta(1), Q: Θ(n)\Theta(n), R: Θ(n)\Theta(n)

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a stack data structure into which we can PUSH and POP records. Assume that each record pushed in the stack has a positive integer key and that all keys are distinct.

      We wish to augment the stack data structure with an O(1)O(1) time MIN operation that returns a pointer to the record with smallest key present in the stack

      1) without deleting the corresponding record, and
      2) without increasing the complexities of the standard stack operations.

      Which one or more of the following approach(es) can achieve it?

      1. (a) Keep with every record in the stack, a pointer to the record with the smallest key below it.
      2. (b) Keep a pointer to the record with the smallest key in the stack.
      3. (c) Keep an auxiliary array in which the key values of the records in the stack are maintained in sorted order.
      4. (d) Keep a Min-Heap in which the key values of the records in the stack are maintained.
      Show answer

      (a) Keep with every record in the stack, a pointer to the record with the smallest key below it.

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let **LIST** be a datatype for an implementation of linked list defined as follows: ``` typedef struct list { int data; struct list *next; } LIST; ``` Suppose a program has created two linked lists, L1 and L2, whose contents are given in the figure below (code for creating L1 and L2 is not provided here). L1 contains 9 nodes, and L2 contains 7 nodes. L1: 1 → 7 → 12 → 3 → 9 → 5 → 11 → 15 → 8 → NULL L2: 1 → 11 → 6 → 9 → 15 → 12 → 4 → NULL Consider the following C program segment that modifies the list L1. The number of nodes that will be there in L1 after the execution of the code segment is ________ . (Answer in integer) ``` int find (int query, LIST *list) { while (list != NULL){ if(list->data == query) return 1; list = list->next; } return 0; } int main () { … … … ptr1=L1; ptr2=L2; while (ptr1->next != NULL){ query = ptr1->next->data; if (find (query, L2)) ptr1->next = ptr1->next->next; else ptr1 = ptr1->next; } … … … return 0; } ```

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      In a double hashing scheme, h1(k)=k mod 11h_1(k) = k \bmod 11 and h2(k)=1+(k mod 7)h_2(k) = 1 + (k \bmod 7) are the auxiliary hash functions. The size mm of the hash table is 11. The hash function for the ii-th probe in the open address table is [h1(k)+i h2(k)] mod m[h_1(k) + i\,h_2(k)] \bmod m. The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.

      The slot at which key 24 gets stored is ___________. (Answer in integer)

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      You are given a set VV of distinct integers. A binary search tree TT is created by inserting all elements of VV one by one, starting with an empty tree. The tree TT follows the convention that, at each node, all values stored in the left subtree of the node are smaller than the value stored at the node. You are not aware of the sequence in which these values were inserted into TT, and you do not have access to TT.

      Which one of the following statements is TRUE?

      1. (a) Inorder traversal of TT can be determined from VV
      2. (b) Root node of TT can be determined from VV
      3. (c) Preorder traversal of TT can be determined from VV
      4. (d) Postorder traversal of TT can be determined from VV
      Show answer

      (a) Inorder traversal of TT can be determined from VV

    20. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      An array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified array?

      1. (a) 82, 90, 101
      2. (b) 82, 11, 93
      3. (c) 131, 11, 93
      4. (d) 131, 111, 90
      Show answer

      (d) 131, 111, 90

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices.

      The C code snippet given below has been written to compute the length of the longest subarray of X that contains at most two distinct integers. The code has two missing expressions labelled (P)(P) and (Q)(Q).

      ```
      int first=0, second=0, len1=0, len2=0, maxlen=0;
      for (int i=0; i < n; i++) {
      if (X[i] == first) {
      len2++; len1++;
      } else if (X[i] == second) {
      len2++;
      len1 = (P);
      second = first;
      } else {
      len2 = (Q);
      len1 = 1; second = first;
      }
      if (len2 > maxlen) {
      maxlen = len2;
      }
      first = X[i];
      }
      ```

      Which one of the following options gives the CORRECT missing expressions?

      (Hint: At the end of the i-th iteration, the value of len1 is the length of the longest subarray ending with X[i] that contains all equal values, and len2 is the length of the longest subarray ending with X[i] that contains at most two distinct values.)

      1. (a) (P) len1+1 (Q) len2+1
      2. (b) (P) 1 (Q) len1+1
      3. (c) (P) 1 (Q) len2+1
      4. (d) (P) len2+1 (Q) len1+1
      Show answer

      (b) (P) 1 (Q) len1+1

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a binary min-heap containing 105 distinct elements. Let kk be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of kk is

      1. (a) 53
      2. (b) 52
      3. (c) 27
      4. (d) 1
      Show answer

      (a) 53

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let S1 and S2 be two stacks. S1 has capacity of 4 elements. S2 has capacity of 2 elements. S1 already has 4 elements: 100, 200, 300, and 400, whereas S2 is empty, as shown below. Stack S1 (top to bottom): 400 (Top), 300, 200, 100. Stack S2: empty. Only the following three operations are available: PushToS2: Pop the top element from S1 and push it on S2. PushToS1: Pop the top element from S2 and push it on S1. GenerateOutput: Pop the top element from S1 and output it to the user. Note that the pop operation is not allowed on an empty stack and the push operation is not allowed on a full stack. Which of the following output sequences can be generated by using the above operations?

      1. (a) 100, 200, 400, 300
      2. (b) 200, 300, 400, 100
      3. (c) 400, 200, 100, 300
      4. (d) 300, 200, 400, 100
      Show answer

      ()

    24. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following sequences when stored in an array at locations A[1],…,A[10]A[1], \ldots, A[10] forms a max-heap?

      1. (a) 23, 17, 10, 6, 13, 14, 1, 5, 7, 12
      2. (b) 23, 17, 14, 7, 13, 10, 1, 5, 6, 12
      3. (c) 23, 17, 14, 6, 13, 10, 1, 5, 7, 15
      4. (d) 23, 14, 17, 1, 10, 13, 16, 12, 7, 5
      Show answer

      (b) 23, 17, 14, 7, 13, 10, 1, 5, 6, 12

    25. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list.

      Let nn denote the number of nodes in each of the linked lists. Which one of the following choices is TRUE about the worst-case time complexity of SLLdel and DLLdel?

      1. (a) SLLdel is O(1)O(1) and DLLdel is O(n)O(n)
      2. (b) Both SLLdel and DLLdel are O(log⁡(n))O(\log(n))
      3. (c) Both SLLdel and DLLdel are O(1)O(1)
      4. (d) SLLdel is O(n)O(n) and DLLdel is O(1)O(1)
      Show answer

      (d) SLLdel is O(n)O(n) and DLLdel is O(1)O(1)

    26. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of collisions. Let kk be the number of keys, mm be the number of slots in the hash table, and k>mk > m.

      Which one of the following is the best hashing strategy to counteract the adversary?

      1. (a) Division method, i.e., use the hash function h(k)=k mod mh(k) = k \bmod m.
      2. (b) Multiplication method, i.e., use the hash function h(k)=⌊m(kA−⌊kA⌋)⌋h(k) = \lfloor m(kA - \lfloor kA \rfloor)\rfloor, where AA is a carefully chosen constant.
      3. (c) Universal hashing method.
      4. (d) If kk is a prime number, use Division method. Otherwise, use Multiplication method.
      Show answer

      (c) Universal hashing method.

    27. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let A be a priority queue for maintaining a set of elements. Suppose A is implemented using a max-heap data structure. The operation Extract-Max(A) extracts and deletes the maximum element from A. The operation Insert(A,key) inserts a new element key in A. The properties of a max-heap are preserved at the end of each of these operations.

      When A contains nn elements, which one of the following statements about the worst case running time of these two operations is TRUE?

      1. (a) Both Extract-Max(A) and Insert(A,key) run in O(1)O(1).
      2. (b) Both Extract-Max(A) and Insert(A,key) run in O(log⁡(n))O(\log(n)).
      3. (c) Extract-Max(A) runs in O(1)O(1) whereas Insert(A,key) runs in O(n)O(n).
      4. (d) Extract-Max(A) runs in O(1)O(1) whereas Insert(A,key) runs in O(log⁡(n))O(\log(n)).
      Show answer

      (b) Both Extract-Max(A) and Insert(A,key) run in O(log⁡(n))O(\log(n)).

    28. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the C function foo and the binary tree shown. ```c typedef struct node { int val; struct node *left, *right; } node; int foo(node *p) { int retval; if (p == NULL) return 0; else { retval = p->val + foo(p->left) + foo(p->right); printf("%d ", retval); return retval; } } ``` The binary tree: root 10; 10 has left child 5 and right child 11; 5 has left child 3 and right child 8; 11 has only a right child 13. When foo is called with a pointer to the root node of the given binary tree, what will it print?

      1. (a) 3 8 5 13 11 10
      2. (b) 3 5 8 10 11 13
      3. (c) 3 8 16 13 24 50
      4. (d) 3 16 8 50 24 13
      Show answer

      (c) 3 8 16 13 24 50

    29. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a sequence aa of elements a0=1,a1=5,a2=7,a3=8,a4=9,a_0 = 1, a_1 = 5, a_2 = 7, a_3 = 8, a_4 = 9, and a5=2a_5 = 2. The following operations are performed on a stack SS and a queue QQ, both of which are initially empty.

      I: push the elements of aa from a0a_0 to a5a_5 in that order into SS.

      II: enqueue the elements of aa from a0a_0 to a5a_5 in that order into QQ.

      III: pop an element from SS.

      IV: dequeue an element from QQ.

      V: pop an element from SS.

      VI: dequeue an element from QQ.

      VII: dequeue an element from QQ and push the same element into SS.

      VIII: Repeat operation VII three times.

      IX: pop an element from SS.

      X: pop an element from SS.

      The top element of SS after executing the above operations is ____________.

    30. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the problem of reversing a singly linked list. To take an example, given the linked list below,

      head → a → b → c → d → e → NULL

      the reversed linked list should look like

      head → e → d → c → b → a → NULL

      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?

      1. (a) The best algorithm for the problem takes θ(n)\theta(n) time in the worst case.
      2. (b) The best algorithm for the problem takes θ(nlog⁡n)\theta(n \log n) time in the worst case.
      3. (c) The best algorithm for the problem takes θ(n2)\theta(n^2) time in the worst case.
      4. (d) It is not possible to reverse a singly linked list in O(1)O(1) space.
      Show answer

      (a) The best algorithm for the problem takes θ(n)\theta(n) time in the worst case.

    31. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      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?

      1. (a) mn\dfrac{m}{n}
      2. (b) nm\dfrac{n}{m}
      3. (c) 2nm\dfrac{2n}{m}
      4. (d) n2m\dfrac{n}{2m}
      Show answer

      (b) nm\dfrac{n}{m}

    32. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

    33. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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

      1. (a) A3A^3
      2. (b) A3A^3 divided by 22
      3. (c) A3A^3 divided by 33
      4. (d) A3A^3 divided by 66
      Show answer

      (d) A3A^3 divided by 66

    34. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

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

      1. (a) The diagonal entries of A2A^2 are the degrees of the vertices of the graph.
      2. (b) If the graph is connected, then none of the entries of An−1+InA^{n-1} + I_n can be zero.
      3. (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.
      4. (d) If there is at least a 1 in each of AA’s rows and columns, then the graph must be connected.
      Show answer

      (a) The diagonal entries of A2A^2 are the degrees of the vertices of the graph.

    35. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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___________.

      Initial State: Q1 = [1, 2, 3, 4] (head at 1), Q2 empty.
      Final State: Q1 empty, Q2 = [4, 3, 2, 1] (head at 4).

    36. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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) Θ(nlog⁡n)\Theta(n \log n)
      Show answer

      (c) Θ(n)\Theta(n)

    37. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      1. (a) Θ(nlog⁡n)\Theta(n \log n)
      2. (b) Θ(n)\Theta(n)
      3. (c) Θ(log⁡n)\Theta(\log n)
      4. (d) Θ(1)\Theta(1)
      Show answer

      (d) Θ(1)\Theta(1)

    38. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

      The value of ∣A−B∣\lvert A - B \rvert is __________.

    39. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following sequence of operations on an empty stack. push(54); push(52); pop(); push(55); push(62); s = pop(); Consider the following sequence of operations on an empty queue. enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue(); The value of s + q is ______.

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a *dynamic* hashing approach for 4-bit integer keys: 1. There is a main hash table of size 4. 2. The 2 least significant bits of a key is used to index into the main hash table. 3. Initially, the main hash table entries are empty. 4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table entry is organized as a binary tree that grows on demand. 5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees. 6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on the 4th least significant bit. 7. A split is done only if it is needed, i.e., only when there is a collision. Consider the following state of the hash table. [Entry 00: empty. Entry 01: a node split on the 3rd bit, whose 0-branch is a single key and whose 1-branch is a node split on the 4th bit with a single key on each of its 0- and 1-branches. Entry 10: a node split on the 3rd bit with a single key on each of its 0- and 1-branches. Entry 11: a single key.] Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?

      1. (a) 5, 9, 4, 13, 10, 7
      2. (b) 9, 5, 10, 6, 7, 1
      3. (c) 10, 9, 6, 7, 5, 13
      4. (d) 9, 5, 13, 6, 10, 14
      Show answer

      (c) 10, 9, 6, 7, 5, 13

    41. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree?

      1. (a) 10, 11, 12, 15, 16, 18, 19, 20
      2. (b) 11, 12, 10, 16, 19, 18, 20, 15
      3. (c) 20, 19, 18, 16, 15, 12, 11, 10
      4. (d) 19, 16, 18, 20, 11, 12, 10, 15
      Show answer

      (b) 11, 12, 10, 16, 19, 18, 20, 15

    42. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      What is the worst case time complexity of inserting n2n^2 elements into an AVL-tree with nn elements initially?

      1. (a) Θ(n4)\Theta(n^4)
      2. (b) Θ(n2)\Theta(n^2)
      3. (c) Θ(n2log⁡n)\Theta(n^2\log n)
      4. (d) Θ(n3)\Theta(n^3)
      Show answer

      (c) Θ(n2log⁡n)\Theta(n^2\log n)

    43. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      What is the worst case time complexity of inserting nn elements into an empty linked list, if the linked list needs to be maintained in sorted order?

      1. (a) Θ(n)\Theta(n)
      2. (b) Θ(nlog⁡n)\Theta(n\log n)
      3. (c) Θ(n2)\Theta(n^2)
      4. (d) Θ(1)\Theta(1)
      Show answer

      (c) Θ(n2)\Theta(n^2)

    44. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider a double hashing scheme in which the primary hash function is h1(k)=k mod 23h_1(k) = k \bmod 23, and the secondary hash function is h2(k)=1+(k mod 19)h_2(k) = 1 + (k \bmod 19). Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k=90k = 90 is \_\_\_\_\_\_\_.

    45. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      In a balanced binary search tree with nn elements, what is the worst case time complexity of reporting all elements in range [a,b][a,b]? Assume that the number of reported elements is kk.

      1. (a) Θ(log⁡n)\Theta(\log n)
      2. (b) Θ(log⁡n+k)\Theta(\log n + k)
      3. (c) Θ(klog⁡n)\Theta(k\log n)
      4. (d) Θ(nlog⁡k)\Theta(n\log k)
      Show answer

      (b) Θ(log⁡n+k)\Theta(\log n + k)

    46. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is \_\_\_\_\_\_\_.

    47. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following statements:

      I. The smallest element in a max-heap is always at a leaf node

      II. The second largest element in a max-heap is always a child of the root node

      III. A max-heap can be constructed from a binary search tree in Θ(n)\Theta(n) time

      IV. A binary search tree can be constructed from a max-heap in Θ(n)\Theta(n) time

      Which of the above statements are TRUE?

      1. (a) I, II and III
      2. (b) I, II and IV
      3. (c) I, III and IV
      4. (d) II, III and IV
      Show answer

      (a) I, II and III

  6. 09Algorithms6 ch · 1 h 34 min55 PYQ
    1. Asymptotic analysis and recurrences 18′
    2. Searching and sorting 16′
    3. Divide and conquer 15′
    4. Greedy algorithms and minimum spanning trees 15′
    5. Dynamic programming 15′
    6. Graph traversal, shortest paths and NP-completeness basics 15′
    See the 55 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the following recurrence relations:

      For all n>1n > 1,



      T1(n)=4T1(n2)+T2(n)T_1(n) = 4T_1\left(\frac{n}{2}\right) + T_2(n)






      T2(n)=5T2(n4)+Θ(log⁡2n)T_2(n) = 5T_2\left(\frac{n}{4}\right) + \Theta(\log_2 n)




      Assume that for all n≤1n \le 1, T1(n)=1T_1(n) = 1 and T2(n)=1T_2(n) = 1.

      Which one of the following options is correct?

      1. (a) T1(n)=Θ(n2)T_1(n) = \Theta(n^2)
      2. (b) T1(n)=Θ(n2log⁡2n)T_1(n) = \Theta(n^2 \log_2 n)
      3. (c) T1(n)=Θ(nlog⁡45)T_1(n) = \Theta(n^{\log_4 5})
      4. (d) T1(n)=Θ(nlog⁡45log⁡2n)T_1(n) = \Theta(n^{\log_4 5} \log_2 n)
      Show answer

      (a) T1(n)=Θ(n2)T_1(n) = \Theta(n^2)

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      1. (a) log⁡(n), n1/3, 2log⁡(n), log⁡(n!)\log(n), \ n^{1/3}, \ 2^{\log(n)}, \ \log(n!)
      2. (b) n1/3, log⁡(n), log⁡(n!), 2log⁡(n)n^{1/3}, \ \log(n), \ \log(n!), \ 2^{\log(n)}
      3. (c) log⁡(n), n1/3, log⁡(n!), 2log⁡(n)\log(n), \ n^{1/3}, \ \log(n!), \ 2^{\log(n)}
      4. (d) 2log⁡(n), n1/3, log⁡(n), log⁡(n!)2^{\log(n)}, \ n^{1/3}, \ \log(n), \ \log(n!)
      Show answer

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

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      1. (a) T(n)=T(n−1)+1,T(1)=1T(n) = T(n-1) + 1, \quad T(1) = 1
      2. (b) T(n)=2T(n2)+1,T(1)=1T(n) = 2T\left(\dfrac{n}{2}\right) + 1, \quad T(1) = 1
      3. (c) T(n)=2T(n2)+n,T(1)=1T(n) = 2T\left(\dfrac{n}{2}\right) + n, \quad T(1) = 1
      4. (d) T(n)=T(n−1)+n,T(1)=1T(n) = T(n-1) + n, \quad T(1) = 1
      Show answer

      ()

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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)

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) Θ(m+n)\Theta(m + n)
      2. (b) Θ(m+nlog⁡(n))\Theta(m + n\log(n))
      3. (c) Θ(nm)\Theta(nm)
      4. (d) Θ(n3)\Theta(n^3)
      Show answer

      (a) Θ(m+n)\Theta(m + n)

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) Θ(n)\Theta(n)
      2. (b) Θ(log⁡(n))\Theta(\log(n))
      3. (c) Θ(nlog⁡(n))\Theta(n\log(n))
      4. (d) Θ(n2)\Theta(n^2)
      Show answer

      (a) Θ(n)\Theta(n)

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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]=1for k=0,1,2,…,nT[0][k] = T[k][0] = 1 \quad \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] \quad \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 B1: For i = 1, 2, …, n
      For j = 1, 2, …, n
      T[i][j] = 2T[i − 1][j] + 3T[i][j − 1]

      Algorithm B2: For s = 2, 3, …, 2n
      For i = 1, 2, …, n
      For j = 1, 2, …, n
      If (i + j == s)
      T[i][j] = 2T[i − 1][j] + 3T[i][j − 1]
      ```

      Algorithm BkB_k, k∈{1,2}k \in \{1, 2\} is said to be correct if and only if it calculates the correct values of T[i][j]T[i][j], for all 0≤i,j≤n0 \le i, j \le n, (as per the recursive formulation) at the end of the execution of the algorithm BkB_k.

      Which one of the following statements is true?

      1. (a) Both algorithms B1B_1 and B2B_2 are correct
      2. (b) Algorithm B1B_1 is correct, but algorithm B2B_2 is incorrect
      3. (c) Algorithm B2B_2 is correct, but algorithm B1B_1 is incorrect
      4. (d) Both algorithms B1B_1 and B2B_2 are incorrect
      Show answer

      (a) Both algorithms B1B_1 and B2B_2 are correct

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let G(V,E)G(V, E) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.

      Let s∈Vs \in V be a vertex in GG. For every u∈Vu \in V and for every k≥0k \ge 0, let dk(u)d_k(u) denote the weight of a shortest path (in terms of weight) from ss to uu of length at most kk. If there is no path from ss to uu of length at most kk, then dk(u)=∞d_k(u) = \infty.

      Consider the statements:

      S1: For every k≥0k \ge 0 and u∈Vu \in V, dk+1(u)≤dk(u)d_{k+1}(u) \le d_k(u).

      S2: For every (u,v)∈E(u, v) \in E, if (u,v)(u, v) is part of a shortest path (in terms of weight) from ss to vv, then for every k≥0k \ge 0, dk(u)≤dk(v)d_k(u) \le d_k(v).

      Which one of the following options 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
      Show answer

      (a) Only S1 is true

    9. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let G(V,E)G(V, E) be a simple, undirected, edge-weighted graph with unique edge weights.

      Which of the following statements about the minimum spanning trees (MST) of GG is/are true?

      1. (a) In every cycle CC of GG, the edge with the largest weight in CC is not in any MST
      2. (b) In every cycle CC of GG, the edge with the smallest weight in CC is in every MST
      3. (c) For every vertex v∈Vv \in V, the edge with the largest weight incident on vv is not in any MST
      4. (d) For every vertex v∈Vv \in V, the edge with the smallest weight incident on vv is in every MST
      Show answer

      ()

    10. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph G(V,E)G(V, E) as input, where d[v]d[v] and f[v]f[v] are the discovery time and finishing time, respectively, of the vertex v∈Vv \in V.

      ```
      DFS(G): Explore(G, v, t):
      unmark all v ∈ V mark v
      t ← 0 t ← t + 1
      for each v ∈ V d[v] ← t
      if v is unmarked for each (v, w) ∈ E
      t ← Explore(G, v, t) if w is unmarked
      end if t ← Explore(G, w, t)
      end for end if
      end for
      t ← t + 1
      f[v] ← t
      return t
      ```

      Suppose that the input directed graph G(V,E)G(V, E) is a directed acyclic graph (DAG).

      For an edge (u,v)∈E(u, v) \in E, which of the following options will NEVER be correct?

      1. (a) d[u]<d[v]<f[v]<f[u]d[u] < d[v] < f[v] < f[u]
      2. (b) d[v]<d[u]<f[u]<f[v]d[v] < d[u] < f[u] < f[v]
      3. (c) d[v]<f[v]<d[u]<f[u]d[v] < f[v] < d[u] < f[u]
      4. (d) d[u]<d[v]<f[u]<f[v]d[u] < d[v] < f[u] < f[v]
      Show answer

      ()

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let GG be any undirected graph with positive edge weights, and TT be a minimum spanning tree of GG. For any two vertices, uu and vv, let d1(u,v)d_1(u, v) and d2(u,v)d_2(u, v) be the shortest distances between uu and vv in GG and TT, respectively. Which ONE of the options is CORRECT for all possible GG, TT, uu and vv?

      1. (a) d1(u,v)=d2(u,v)d_1(u, v) = d_2(u, v)
      2. (b) d1(u,v)≤d2(u,v)d_1(u, v) \le d_2(u, v)
      3. (c) d1(u,v)≥d2(u,v)d_1(u, v) \ge d_2(u, v)
      4. (d) d1(u,v)≠d2(u,v)d_1(u, v) \ne d_2(u, v)
      Show answer

      (b) d1(u,v)≤d2(u,v)d_1(u, v) \le d_2(u, v)

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following recurrence relation:



      T(n)=2T(n−1)+n2n for n>0,T(0)=1.T(n) = 2T(n - 1) + n2^n \text{ for } n > 0, \quad T(0) = 1.




      Which ONE of the following options is CORRECT?

      1. (a) T(n)=Θ(n22n)T(n) = \Theta(n^2 2^n)
      2. (b) T(n)=Θ(n2n)T(n) = \Theta(n2^n)
      3. (c) T(n)=Θ((log⁡n)22n)T(n) = \Theta((\log n)^2 2^n)
      4. (d) T(n)=Θ(4n)T(n) = \Theta(4^n)
      Show answer

      (a) T(n)=Θ(n22n)T(n) = \Theta(n^2 2^n)

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider an unordered list of NN distinct integers.

      What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?

      1. (a) 1
      2. (b) N−1N - 1
      3. (c) NN
      4. (d) 2N−12N - 1
      Show answer

      (a) 1

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph G is/are TRUE?

      1. (a) A DFS tree of GG is a Shortest Path tree of GG.
      2. (b) Every non-tree edge of G with respect to a DFS tree is a forward/back edge.
      3. (c) If (u,v)(u, v) is a non-tree edge of G with respect to a BFS tree, then the distances from the source vertex ss to uu and vv in the BFS tree are within ±1\pm 1 of each other.
      4. (d) Both BFS and DFS can be used to find the connected components of G.
      Show answer

      ()

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The pseudocode of a function fun() is given below:

      ```
      fun(int A[0,…,n-1]){
      for i=0 to n-2
      for j=0 to n-i-2
      if (A[j]>A[j+1])
      then swap A[j] and A[j+1]

      }
      ```

      Let A[0,…,29]A[0, \ldots ,29] be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun() is called with A[0,…,29]A[0, \ldots ,29] as argument, is __________. (Answer in integer)

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let GG be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant α\alpha is added to the weight of every edge.

      Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in GG before and after the edge weight update?

      1. (a) Every MST remains an MST, and every SP remains an SP.
      2. (b) MSTs need not remain MSTs, and every SP remains an SP.
      3. (c) Every MST remains an MST, and SPs need not remain SPs.
      4. (d) MSTs need not remain MSTs, and SPs need not remain SPs.
      Show answer

      (c) Every MST remains an MST, and SPs need not remain SPs.

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      An array AA of length nn with distinct elements is said to be bitonic if there is an index 1≤i≤n1 \le i \le n such that A[1..i]A[1..i] is sorted in the non-decreasing order and A[i+1..n]A[i+1..n] is sorted in the non-increasing order.

      Which ONE of the following represents the best possible asymptotic bound for the worst-case number of comparisons by an algorithm that searches for an element in a bitonic array AA?

      1. (a) Θ(n)\Theta(n)
      2. (b) Θ(1)\Theta(1)
      3. (c) Θ(log⁡2n)\Theta(\log^{2} n)
      4. (d) Θ(log⁡n)\Theta(\log n)
      Show answer

      (d) Θ(log⁡n)\Theta(\log n)

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let G(V,E)G(V, E) be an undirected and unweighted graph with 100 vertices. Let d(u,v)d(u, v) denote the number of edges in a shortest path between vertices uu and vv in VV. Let the maximum value of d(u,v)d(u, v), u,v∈Vu, v \in V such that u≠vu \ne v, be 30. Let TT be any breadth-first-search tree of GG. Which ONE of the given options is CORRECT for every such graph GG?

      1. (a) The height of TT is exactly 15.
      2. (b) The height of TT is exactly 30.
      3. (c) The height of TT is at least 15.
      4. (d) The height of TT is at least 30.
      Show answer

      (c) The height of TT is at least 15.

    19. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following algorithm someAlgo that takes an undirected graph GG as input.

      ```
      someAlgo(G)

      1. Let v be any vertex in G. Run BFS on G starting at
      v. Let u be a vertex in G at maximum distance from
      v as given by the BFS.
      2. Run BFS on G again with u as the starting vertex.
      Let z be the vertex at maximum distance from u as
      given by the BFS.
      3. Output the distance between u and z in G.
      ```

      The output of someAlgo(TT) for the tree shown in the given figure is ___________. (Answer in integer)

    20. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The maximum value of xx such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is _________ . (answer in integer)

      Undirected graph on vertices A, B, C, D with edges: A–B weight 7, A–D weight 6, D–C weight 8, B–C weight xx, B–D weight 1, A–C weight 3.

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let T(n)T(n) be the recurrence relation defined as follows:



      T(0)=1,T(1)=2, andT(n)=5T(n−1)−6T(n−2)for n≥2T(0) = 1,\quad T(1) = 2, \text{ and}\quad T(n) = 5T(n-1) - 6T(n-2) \quad \text{for } n \ge 2




      Which one of the following statements is TRUE?

      1. (a) T(n)=Θ(2n)T(n) = \Theta(2^n)
      2. (b) T(n)=Θ(n2n)T(n) = \Theta(n2^n)
      3. (c) T(n)=Θ(3n)T(n) = \Theta(3^n)
      4. (d) T(n)=Θ(n3n)T(n) = \Theta(n3^n)
      Show answer

      (a) T(n)=Θ(2n)T(n) = \Theta(2^n)

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Given an integer array of size N, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single pass through the array and comparing each element of the array only with its adjacent elements. The worst-case time complexity of this algorithm is

      1. (a) both O(N)O(N) and Ω(N)\Omega(N)
      2. (b) O(N)O(N) but not Ω(N)\Omega(N)
      3. (c) Ω(N)\Omega(N) but not O(N)O(N)
      4. (d) neither O(N)O(N) nor Ω(N)\Omega(N)
      Show answer

      (a) both O(N)O(N) and Ω(N)\Omega(N)

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The number of spanning trees in a *complete* graph of 4 vertices labelled A, B, C, and D is _________

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let AA be an array containing integer values. The distance of AA is defined as the minimum number of elements in AA that must be replaced with another integer so that the resulting array is sorted in non-decreasing order. The distance of the array [2, 5, 3, 1, 4, 2, 6] is ___________

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following recurrence relation:



      T(n)={n T(n)+nfor n≥1,1for n=1.T(n) = \begin{cases} \sqrt{n}\,T(\sqrt{n}) + n & \text{for } n \ge 1, \\ 1 & \text{for } n = 1. \end{cases}




      Which one of the following options is CORRECT?

      1. (a) T(n)=Θ(nlog⁡log⁡n)T(n) = \Theta(n \log\log n)
      2. (b) T(n)=Θ(nlog⁡n)T(n) = \Theta(n \log n)
      3. (c) T(n)=Θ(n2log⁡n)T(n) = \Theta(n^2 \log n)
      4. (d) T(n)=Θ(n2log⁡log⁡n)T(n) = \Theta(n^2 \log\log n)
      Show answer

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

    26. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let GG be a directed graph and TT a depth first search (DFS) spanning tree in GG that is rooted at a vertex vv. Suppose TT is also a breadth first search (BFS) tree in GG, rooted at vv. Which of the following statements is/are TRUE for every such graph GG and tree TT ?

      1. (a) There are no back-edges in GG with respect to the tree TT
      2. (b) There are no cross-edges in GG with respect to the tree TT
      3. (c) There are no forward-edges in GG with respect to the tree TT
      4. (d) The only edges in GG are the edges in TT
      Show answer

      (c) There are no forward-edges in GG with respect to the tree TT

    27. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let GG be an undirected connected graph in which every edge has a positive integer weight. Suppose that every spanning tree in GG has even weight. Which of the following statements is/are TRUE for every such graph GG ?

      1. (a) All edges in GG have even weight
      2. (b) All edges in GG have even weight OR all edges in GG have odd weight
      3. (c) In each cycle CC in GG, all edges in CC have even weight
      4. (d) In each cycle CC in GG, either all edges in CC have even weight OR all edges in CC have odd weight
      Show answer

      (d) In each cycle CC in GG, either all edges in CC have even weight OR all edges in CC have odd weight

    28. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      The number of distinct minimum-weight spanning trees of the following graph is _________ Undirected weighted graph on vertices a, b, c, d, e, f, g with edges: a–b 1, a–f 1, a–g 2, b–g 2, b–c 3, f–g 2, f–e 3, c–g 2, g–d 2, g–e 2, c–d 1, d–e 1.

    29. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The number of edges present in the forest generated by the DFS traversal of an undirected graph GG with 100 vertices is 40. The number of connected components in GG is _________

    30. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let ff and gg be functions of natural numbers given by f(n)=nf(n) = n and g(n)=n2g(n) = n^2.

      Which of the following statements is/are TRUE?

      1. (a) f∈O(g)f \in O(g)
      2. (b) f∈Ω(g)f \in \Omega(g)
      3. (c) f∈o(g)f \in o(g)
      4. (d) f∈Θ(g)f \in \Theta(g)
      Show answer

      ()

    31. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider functions Function_1 and Function_2 expressed in pseudocode as follows:

      ```
      Function_1
      while n > 1 do
      for i = 1 to n do
      x = x + 1;
      end for
      n = ⌊n/2⌋;
      end while

      Function_2
      for i = 1 to 100 ∗ n do
      x = x + 1;
      end for
      ```

      Let f1(n)f_1(n) and f2(n)f_2(n) denote the number of times the statement “x=x+1x = x + 1” is executed in Function_1 and Function_2, respectively.

      Which of the following statements is/are TRUE?

      1. (a) f1(n)∈Θ(f2(n))f_1(n) \in \Theta(f_2(n))
      2. (b) f1(n)∈o(f2(n))f_1(n) \in o(f_2(n))
      3. (c) f1(n)∈ω(f2(n))f_1(n) \in \omega(f_2(n))
      4. (d) f1(n)∈O(n)f_1(n) \in O(n)
      Show answer

      ()

    32. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let U={1,2,3}U = \{1, 2, 3\}. Let 2U2^U denote the powerset of UU. Consider an undirected graph GG whose vertex set is 2U2^U. For any A,B∈2UA, B \in 2^U, (A,B)(A, B) is an edge in GG if and only if (i) A≠BA \ne B, and (ii) either A⊊BA \subsetneq B or B⊊AB \subsetneq A. For any vertex AA in GG, the set of all possible orderings in which the vertices of GG can be visited in a Breadth First Search (BFS) starting from AA is denoted by B(A)\mathcal{B}(A).

      If ∅\emptyset denotes the empty set, then the cardinality of B(∅)\mathcal{B}(\emptyset) is ____________.

    33. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      1. (a) f(n2)=θ(f(n)2)f(n^2) = \theta(f(n)^2), when f(n)f(n) is a polynomial
      2. (b) f(n2)=o(f(n)2)f(n^2) = o(f(n)^2)
      3. (c) f(n2)=O(f(n)2)f(n^2) = O(f(n)^2), when f(n)f(n) is an exponential function
      4. (d) f(n2)=Ω(f(n)2)f(n^2) = \Omega(f(n)^2)
      Show answer

      (a) f(n2)=θ(f(n)2)f(n^2) = \theta(f(n)^2), when f(n)f(n) is a polynomial

    34. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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?

      1. (a) The edge with the second smallest weight is always part of any minimum spanning tree of GG.
      2. (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.
      3. (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.
      4. (d) GG can have multiple minimum spanning trees.
      Show answer

      ()

    35. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

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

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

      Which one of the following options is correct?

      1. (a) Both S1S_1 and S2S_2 are true.
      2. (b) S1S_1 is true and S2S_2 is false.
      3. (c) S1S_1 is false and S2S_2 is true.
      4. (d) Both S1S_1 and S2S_2 are false.
      Show answer

      (c) S1S_1 is false and S2S_2 is true.

    36. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      1. (a) t>2n−2t > 2n - 2
      2. (b) t>3⌈n2⌉t > 3\left\lceil \dfrac{n}{2} \right\rceil and t≤2n−2t \le 2n - 2
      3. (c) t>nt > n and t≤3⌈n2⌉t \le 3\left\lceil \dfrac{n}{2} \right\rceil
      4. (d) t>⌈log⁡2(n)⌉t > \lceil \log_2(n) \rceil and t≤nt \le n
      Show answer

      (c) t>nt > n and t≤3⌈n2⌉t \le 3\left\lceil \dfrac{n}{2} \right\rceil

    37. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following three functions.



      f1=10nf2=nlog⁡nf3=nnf_1 = 10^n \qquad f_2 = n^{\log n} \qquad f_3 = n^{\sqrt{n}}




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

      1. (a) f3, f2, f1f_3,\ f_2,\ f_1
      2. (b) f2, f1, f3f_2,\ f_1,\ f_3
      3. (c) f1, f2, f3f_1,\ f_2,\ f_3
      4. (d) f2, f3, f1f_2,\ f_3,\ f_1
      Show answer

      (d) f2, f3, f1f_2,\ f_3,\ f_1

    38. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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) Θ(log⁡2(n))\Theta(\log_2(n))
      3. (c) Θ(n2)\Theta(n^2)
      4. (d) Θ(n)\Theta(n)
      Show answer

      (b) Θ(log⁡2(n))\Theta(\log_2(n))

    39. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following array. | 23 | 32 | 45 | 69 | 72 | 73 | 89 | 97 | |---|---|---|---|---|---|---|---| Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?

      1. (a) Selection sort
      2. (b) Mergesort
      3. (c) Insertion sort
      4. (d) Quicksort using the last element as pivot
      Show answer

      (c) Insertion sort

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following undirected graph with edge weights as shown: [The graph is a 3 × 3 grid of vertices. Top row (left to right): edges of weight 0.1 and 0.1. Middle row: edges of weight 0.1 and 0.9. Bottom row: edges of weight 0.9 and 0.1. Vertical edges between the top and middle rows (left, centre, right): 0.9, 0.9, 0.9. Vertical edges between the middle and bottom rows (left, centre, right): 0.1, 0.1, 0.1.] The number of minimum-weight spanning trees of the graph is ______.

    41. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the string **abbccddeee**. 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
      Show answer

      (b) 23

    42. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following recurrence relation.



      T(n)={T(n/2)+T(2n/5)+7nif n>01if n=0T(n) = \begin{cases} T(n/2) + T(2n/5) + 7n & \text{if } n > 0 \\ 1 & \text{if } n = 0 \end{cases}




      Which one of the following options is correct?

      1. (a) T(n)=Θ(n5/2)T(n) = \Theta(n^{5/2})
      2. (b) T(n)=Θ(nlog⁡n)T(n) = \Theta(n \log n)
      3. (c) T(n)=Θ(n)T(n) = \Theta(n)
      4. (d) T(n)=Θ((log⁡n)5/2)T(n) = \Theta((\log n)^{5/2})
      Show answer

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

    43. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      For constants a≥1a \ge 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(\frac{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)}).
      Show answer

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

    44. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Define RnR_n to be the maximum amount earned by cutting a rod of length nn meters into one or more pieces of integer length and selling them. For i>0\mathtt{i} > 0, let p[i]\mathtt{p[i]} denote the selling price of a rod whose length is i\mathtt{i} meters. Consider the array of prices:

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

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

      1. (a) R7=18R_7 = 18
      2. (b) R7=19R_7 = 19
      3. (c) R7R_7 is achieved by three different solutions.
      4. (d) R7R_7 cannot be achieved by a solution consisting of three pieces.
      Show answer

      ()

    45. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      An *articulation point* in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components.

      Let TT be a DFS tree obtained by doing DFS in a connected undirected graph GG.

      Which of the following options is/are correct?

      1. (a) Root of TT can never be an articulation point in GG.
      2. (b) Root of TT is an articulation point in GG if and only if it has 2 or more children.
      3. (c) A leaf of TT can be an articulation point in GG.
      4. (d) If uu is an articulation point in GG such that xx is an ancestor of uu in TT and yy is a descendent of uu in TT, then all paths from xx to yy in GG must pass through uu.
      Show answer

      (b) Root of TT is an articulation point in GG if and only if it has 2 or more children.

    46. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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 uu and vv, there is a directed path from uu to vv.
      Show answer

      ()

    47. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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 vv other than s, the quality-score of vv is defined to be the maximum among the quality-scores of all the paths from s to vv. The quality-score of s is assumed to be 1.

      The sum of the quality-scores of all the vertices in the graph shown above is __________.

    48. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      For parameters aa and bb, both of which are ω(1)\omega(1), T(n)=T(n1/a)+1T(n)=T(n^{1/a})+1, and T(b)=1T(b)=1. Then T(n)T(n) is

      1. (a) Θ(log⁡alog⁡bn)\Theta(\log_a \log_b n)
      2. (b) Θ(log⁡abn)\Theta(\log_{ab} n)
      3. (c) Θ(log⁡blog⁡an)\Theta(\log_b \log_a n)
      4. (d) Θ(log⁡2log⁡2n)\Theta(\log_2 \log_2 n)
      Show answer

      (a) Θ(log⁡alog⁡bn)\Theta(\log_a \log_b n)

    49. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let G=(V,E)G = (V,E) be a weighted undirected graph and let TT be a Minimum Spanning Tree (MST) of GG maintained using adjacency lists. Suppose a new weighted edge (u,v)∈V×V(u,v) \in V \times V is added to GG. The worst case time complexity of determining if TT is still an MST of the resultant graph is

      1. (a) Θ(∣E∣+∣V∣)\Theta(\lvert E \rvert + \lvert V \rvert)
      2. (b) Θ(∣E∣∣V∣)\Theta(\lvert E \rvert \lvert V \rvert)
      3. (c) Θ(∣E∣log⁡∣V∣)\Theta(\lvert E \rvert \log \lvert V \rvert)
      4. (d) Θ(∣V∣)\Theta(\lvert V \rvert)
      Show answer

      (d) Θ(∣V∣)\Theta(\lvert V \rvert)

    50. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let G=(V,E)G = (V,E) be a directed, weighted graph with weight function w:E→Rw : E \to \mathbb{R}. For some function f:V→Rf : V \to \mathbb{R}, for each edge (u,v)∈E(u,v) \in E, define w′(u,v)w'(u,v) as w(u,v)+f(u)−f(v)w(u,v) + f(u) - f(v).

      Which one of the options completes the following sentence so that it is TRUE?

      "The shortest paths in GG under ww are shortest paths under w′w' too, \_\_\_\_\_\_\_\_".

      1. (a) for every f:V→Rf : V \to \mathbb{R}
      2. (b) if and only if ∀u∈V\forall u \in V, f(u)f(u) is positive
      3. (c) if and only if ∀u∈V\forall u \in V, f(u)f(u) is negative
      4. (d) if and only if f(u)f(u) is the distance from ss to uu in the graph obtained by adding a new vertex ss to GG and edges of zero weight from ss to every vertex of GG
      Show answer

      (a) for every f:V→Rf : V \to \mathbb{R}

    51. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a graph G=(V,E)G = (V,E), where V={v1,v2,…,v100}V = \{v_1, v_2, \ldots, v_{100}\}, E={(vi,vj)∣1≤i<j≤100}E = \{(v_i, v_j) \mid 1 \le i < j \le 100\}, and weight of the edge (vi,vj)(v_i, v_j) is ∣i−j∣\lvert i - j \rvert. The weight of minimum spanning tree of GG is \_\_\_\_\_\_\_\_.

    52. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is ________.

    53. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider a sequence of 14 elements: A = [−5, −10, 6, 3, −1, −2, 13, 4, −9, −1, 4, 12, −3, 0]. The subsequence sum S(i,j)=∑k=ijA[k]S(i, j) = \sum_{k=i}^{j} A[k]. Determine the maximum of S(i,j)S(i, j), where 0≤i≤j<140 \le i \le j < 14. (Divide and conquer approach may be used.)

      Answer: ________.

    54. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      There are nn unsorted arrays: A1,A2,…,AnA_1, A_2, \ldots, A_n. Assume that nn is odd. Each of A1,A2,…,AnA_1, A_2, \ldots, A_n contains nn distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of A1,A2,…,AnA_1, A_2, \ldots, A_n is

      1. (a) O(n)O(n)
      2. (b) O(nlog⁡n)O(n \log n)
      3. (c) O(n2)O(n^2)
      4. (d) Ω(n2log⁡n)\Omega(n^2 \log n)
      Show answer

      (c) O(n2)O(n^2)

    55. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let GG be any connected, weighted, undirected graph.

      I. GG has a unique minimum spanning tree, if no two edges of GG have the same weight.

      II. GG has a unique minimum spanning tree, if, for every cut of GG, there is a unique minimum-weight edge crossing the cut.

      Which of the above two statements is/are TRUE?

      1. (a) I only
      2. (b) II only
      3. (c) Both I and II
      4. (d) Neither I nor II
      Show answer

      (c) Both I and II

  7. 10Theory of computation4 ch · 1 h 1 min58 PYQ
    1. Regular expressions and finite automata 17′
    2. Regular languages and the pumping lemma 14′
    3. Context-free grammars and pushdown automata 15′
    4. Turing machines and undecidability 15′
    See the 58 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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



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


      1. (a) Turing machine MM halts on all input strings in {0,1}∗\{0,1\}^*
      2. (b) Turing machine MM accepts all input strings in LL
      3. (c) Turing machine MM rejects all input strings in {0,1}∗−L\{0,1\}^* - L
      4. (d) Turing machine MM accepts all input strings in LL and rejects all input strings in {0,1}∗−L\{0,1\}^* - L
      Show answer

      (d) Turing machine MM accepts all input strings in LL and rejects all input strings in {0,1}∗−L\{0,1\}^* - L

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the following grammar where SS is the start symbol, and aa and bb are terminal symbols.



      S→aSbS∣bS∣ϵS \to aSbS \mid bS \mid \epsilon




      Which of the following statements is/are true?

      1. (a) The grammar is ambiguous
      2. (b) The string abbabb has two distinct derivations in this grammar
      3. (c) The string abababab has only one rightmost derivation
      4. (d) The language generated by the grammar is undecidable
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Let M be a nondeterministic finite automaton (NFA) with 6 states over a finite alphabet.

      Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to MM ?

      1. (a) 32
      2. (b) 65
      3. (c) 1
      4. (d) 128
      Show answer

      ()

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      Which of the following grammars is/are ambiguous?

      1. (a) S→aSb∣ϵS \to aSb \mid \epsilon
      2. (b) E→E+E∣E∗E∣idE \to E + E \mid E * E \mid id
      3. (c) S→aS∣Sa∣ϵS \to aS \mid Sa \mid \epsilon
      4. (d) S→aS∣ϵS \to aS \mid \epsilon
      Show answer

      ()

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      Consider the following two finite automata D1D_1 and D2D_2.

      D1D_1: states q0,p1,p2,p3,p4,p5q_0, p_1, p_2, p_3, p_4, p_5; q0q_0 is the start state and the only accepting state. Transitions: q0→0p1q_0 \xrightarrow{0} p_1, p1→0p2p_1 \xrightarrow{0} p_2, p1→1p3p_1 \xrightarrow{1} p_3, p2→0q0p_2 \xrightarrow{0} q_0, p2→1q0p_2 \xrightarrow{1} q_0, p3→0q0p_3 \xrightarrow{0} q_0, q0→1p4q_0 \xrightarrow{1} p_4, p4→0p5p_4 \xrightarrow{0} p_5, p5→1q0p_5 \xrightarrow{1} q_0.

      D2D_2: states r0,r1,r2,r3,r4r_0, r_1, r_2, r_3, r_4; r0r_0 is the start state and the only accepting state. Transitions: r0→0r1r_0 \xrightarrow{0} r_1, r1→1r3r_1 \xrightarrow{1} r_3, r3→1r0r_3 \xrightarrow{1} r_0, r0→1r2r_0 \xrightarrow{1} r_2, r2→1r3r_2 \xrightarrow{1} r_3, r2→0r4r_2 \xrightarrow{0} r_4, r2→1r4r_2 \xrightarrow{1} r_4, r4→0r0r_4 \xrightarrow{0} r_0.

      Which of the following statements is/are true?

      1. (a) L(D1)=L(D2)L(D_1) = L(D_2)
      2. (b) L(D1)L(D_1) is a proper subset of L(D2)L(D_2)
      3. (c) L(D1)∩L(D2)={ϵ}L(D_1) \cap L(D_2) = \{\epsilon\}
      4. (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
      Show answer

      ()

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) i+k=j+ℓi + k = j + \ell
      2. (b) i=k and j=ℓi = k \text{ and } j = \ell
      3. (c) i=ℓ and j=ki = \ell \text{ and } j = k
      4. (d) i+j=k+ℓi + j = k + \ell
      Show answer

      ()

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Let L1L_1 and L2L_2 be two languages over a finite alphabet, such that L1∩L2L_1 \cap L_2 and L2L_2 are regular languages.

      Which of the following statements is/are always true?

      1. (a) L1L_1 is regular
      2. (b) L1∪L2L_1 \cup L_2 is regular
      3. (c) L2L_2 is context-free
      4. (d) L1L_1 is context-free
      Show answer

      (c) L2L_2 is context-free

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the following context-free grammar GG.



      S→abaABAbbaS \to abaABAbba





      A→aaBBAb∣bBabaaA \to aaBBAb \mid bBabaa





      B→aBb∣abB \to aBb \mid ab




      In the above grammar, SS is the start symbol, aa and bb are terminal symbols, and AA and BB are non-terminal symbols.

      Let L(G)L(G) be the language generated by the grammar GG. For a string s∈L(G)s \in L(G), let n1(s)n_1(s) be the number of aa’s in ss and n2(s)n_2(s) be the number of bb’s in ss.

      Which of the following statements is/are true?

      1. (a) There is a string s∈L(G)s \in L(G) such that n1(s)<n2(s)n_1(s) < n_2(s)
      2. (b) For every string s∈L(G)s \in L(G), n1(s)≥n2(s)n_1(s) \ge n_2(s)
      3. (c) There is a string s∈L(G)s \in L(G) such that n1(s)>2n2(s)n_1(s) > 2n_2(s)
      4. (d) For every string s∈L(G)s \in L(G), n1(s)≤2n2(s)n_1(s) \le 2n_2(s)
      Show answer

      ()

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following context-free grammar GG, where SS, AA, and BB are the variables (non-terminals), aa and bb are the terminal symbols, SS is the start variable, and the rules of GG are described as:



      S→aaB∣AbbS \to aaB \mid Abb





      A→a∣aAA \to a \mid aA





      B→b∣bBB \to b \mid bB




      Which ONE of the languages L(G)L(G) is accepted by GG?

      1. (a) L(G)={a2bn∣n≥1}∪{anb2∣n≥1}L(G) = \{a^2 b^n \mid n \ge 1\} \cup \{a^n b^2 \mid n \ge 1\}
      2. (b) L(G)={anb2n∣n≥1}∪{a2nbn∣n≥1}L(G) = \{a^n b^{2n} \mid n \ge 1\} \cup \{a^{2n} b^n \mid n \ge 1\}
      3. (c) L(G)={anbn∣n≥1}L(G) = \{a^n b^n \mid n \ge 1\}
      4. (d) L(G)={a2nb2n∣n≥1}L(G) = \{a^{2n} b^{2n} \mid n \ge 1\}
      Show answer

      (a) L(G)={a2bn∣n≥1}∪{anb2∣n≥1}L(G) = \{a^2 b^n \mid n \ge 1\} \cup \{a^n b^2 \mid n \ge 1\}

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which ONE of the following languages is accepted by a deterministic pushdown automaton?

      1. (a) Any regular language.
      2. (b) Any context-free language.
      3. (c) Any language accepted by a non-deterministic pushdown automaton.
      4. (d) Any decidable language.
      Show answer

      (a) Any regular language.

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let G1G_1, G2G_2 be Context Free Grammars (CFGs) and RR be a regular expression. For a grammar GG, let L(G)L(G) denote the language generated by GG.

      Which ONE among the following questions is decidable?

      1. (a) Is L(G1)=L(G2)L(G_1) = L(G_2)?
      2. (b) Is L(G1)∩L(G2)=∅L(G_1) \cap L(G_2) = \emptyset?
      3. (c) Is L(G1)=L(R)L(G_1) = L(R)?
      4. (d) Is L(G1)=∅L(G_1) = \emptyset?
      Show answer

      (d) Is L(G1)=∅L(G_1) = \emptyset?

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A regular language LL is accepted by a non-deterministic finite automaton (NFA) with nn states. Which of the following statement(s) is/are FALSE?

      1. (a) LL may have an accepting NFA with <n< n states.
      2. (b) LL may have an accepting DFA with <n< n states.
      3. (c) There exists a DFA with ≤2n\le 2^n states that accepts LL.
      4. (d) Every DFA that accepts LL has >2n> 2^n states.
      Show answer

      (d) Every DFA that accepts LL has >2n> 2^n states.

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the two lists List I and List II given below: | List I | List II | |---|---| | (i) Context free languages | (a) Closed under union | | (ii) Recursive languages | (b) Not closed under complementation | | (iii) Regular languages | (c) Closed under intersection | For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?

      1. (a) (i) – (a), (ii) – (b), and (iii) – (c)
      2. (b) (i) – (b), (ii) – (a), and (iii) – (c)
      3. (c) (i) – (b), (ii) – (c), and (iii) – (a)
      4. (d) (i) – (a), (ii) – (c), and (iii) – (b)
      Show answer

      ()

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following two languages over the alphabet {a,b}\{a, b\}:



      L1={αβα∣α∈{a,b}+ AND β∈{a,b}+}L_1 = \{ \alpha\beta\alpha \mid \alpha \in \{a, b\}^+ \text{ AND } \beta \in \{a, b\}^+ \}





      L2={αβα∣α∈{a}+ AND β∈{a,b}+}L_2 = \{ \alpha\beta\alpha \mid \alpha \in \{a\}^+ \text{ AND } \beta \in \{a, b\}^+ \}




      Which ONE of the following statements is CORRECT?

      1. (a) Both L1L_1 and L2L_2 are regular languages.
      2. (b) L1L_1 is a regular language but L2L_2 is not a regular language.
      3. (c) L1L_1 is not a regular language but L2L_2 is a regular language.
      4. (d) Neither L1L_1 nor L2L_2 is a regular language.
      Show answer

      (c) L1L_1 is not a regular language but L2L_2 is a regular language.

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following two languages over the alphabet {a,b,c}\{a, b, c\}, where mm and nn are natural numbers.



      L1={ambmcm+n∣m,n≥1}L_1 = \{a^m b^m c^{m+n} \mid m, n \ge 1\}





      L2={ambncm+n∣m,n≥1}L_2 = \{a^m b^n c^{m+n} \mid m, n \ge 1\}




      Which ONE of the following statements is CORRECT?

      1. (a) Both L1L_1 and L2L_2 are context-free languages.
      2. (b) L1L_1 is a context-free language but L2L_2 is not a context-free language.
      3. (c) L1L_1 is not a context-free language but L2L_2 is a context-free language.
      4. (d) Neither L1L_1 nor L2L_2 are context-free languages.
      Show answer

      (c) L1L_1 is not a context-free language but L2L_2 is a context-free language.

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following deterministic finite automaton (DFA) defined over the alphabet, Σ={a,b}\Sigma = \{a, b\}. Identify which of the following language(s) is/are accepted by the given DFA.

      DFA with four states drawn left to right (numbered here q0q_0 to q3q_3); q0q_0 is the start state and q3q_3 is the only accepting state:

      | State | aa | bb |
      |---|---|---|
      | →q0\to q_0 | q0q_0 | q1q_1 |
      | q1q_1 | q2q_2 | q1q_1 |
      | q2q_2 | q0q_0 | q3q_3 |
      | ∗q3*q_3 | q2q_2 | q1q_1 |

      1. (a) The set of all strings containing an even number of bb’s.
      2. (b) The set of all strings containing the pattern babbab.
      3. (c) The set of all strings ending with the pattern babbab.
      4. (d) The set of all strings not containing the pattern abaaba.
      Show answer

      (c) The set of all strings ending with the pattern babbab.

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let Σ={a,b,c}\Sigma = \{a, b, c\}. For x∈Σ∗x \in \Sigma^{*}, and α∈Σ\alpha \in \Sigma, let #α(x)\#_{\alpha}(x) denote the number of occurrences of α\alpha in xx.

      Which one or more of the following option(s) define(s) regular language(s)?

      1. (a) {ambn∣m,n≥0}\{a^{m}b^{n} \mid m, n \ge 0\}
      2. (b) {a,b}∗∩{ambncm−n∣m≥n≥0}\{a, b\}^{*} \cap \{a^{m}b^{n}c^{m-n} \mid m \ge n \ge 0\}
      3. (c) {w∣w∈{a,b}∗, #a(w)≡2(mod7), and #b(w)≡3(mod9)}\{w \mid w \in \{a, b\}^{*},\ \#_{a}(w) \equiv 2 \pmod 7, \text{ and } \#_{b}(w) \equiv 3 \pmod 9\}
      4. (d) {w∣w∈{a,b}∗, #a(w)≡2(mod7), and #a(w)=#b(w)}\{w \mid w \in \{a, b\}^{*},\ \#_{a}(w) \equiv 2 \pmod 7, \text{ and } \#_{a}(w) = \#_{b}(w)\}
      Show answer

      ()

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let Σ={1,2,3,4}\Sigma = \{1, 2, 3, 4\}. For x∈Σ∗x \in \Sigma^{*}, let prod(x)\mathit{prod}(x) be the product of symbols in xx modulo 7. We take prod(ϵ)=1\mathit{prod}(\epsilon) = 1, where ϵ\epsilon is the null string.

      For example, prod(124)=(1×2×4) mod 7=1\mathit{prod}(124) = (1 \times 2 \times 4) \bmod 7 = 1.

      Define L={x∈Σ∗∣prod(x)=2}L = \{x \in \Sigma^{*} \mid \mathit{prod}(x) = 2\}.

      The number of states in a minimum state DFA for LL is ___________. (Answer in integer)

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which one of the following regular expressions is equivalent to the language accepted by the DFA given below?

      DFA with two states: the start state q0q_0 (non-accepting) and the accepting state q1q_1.

      | State | on 0 | on 1 |
      |---|---|---|
      | →q0\to q_0 | q0q_0 | q1q_1 |
      | ∗q1*q_1 | q1q_1 | q0q_0 |

      1. (a) 0∗1(0+10∗1)∗0^*1(0 + 10^*1)^*
      2. (b) 0∗(10∗11)∗0∗0^*(10^*11)^*0^*
      3. (c) 0∗1(010∗1)∗0∗0^*1(010^*1)^*0^*
      4. (d) 0(1+0∗10∗1)∗0∗0(1 + 0^*10^*1)^*0^*
      Show answer

      (a) 0∗1(0+10∗1)∗0^*1(0 + 10^*1)^*

    20. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let L1,L2L_1, L_2 be two regular languages and L3L_3 a language which is not regular. Which of the following statements is/are *always* TRUE?

      1. (a) L1=L2L_1 = L_2 if and only if L1∩L2‾=ϕL_1 \cap \overline{L_2} = \phi
      2. (b) L1∪L3L_1 \cup L_3 is not regular
      3. (c) L3‾\overline{L_3} is not regular
      4. (d) L1‾∪L2‾\overline{L_1} \cup \overline{L_2} is regular
      Show answer

      ()

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let MM be the 5-state NFA with ϵ\epsilon-transitions shown in the diagram below.

      States 1 to 5; state 1 is the start state; states 2 and 5 are accepting. Transitions: 1→ϵ21 \xrightarrow{\epsilon} 2, 1→ϵ41 \xrightarrow{\epsilon} 4, 2→032 \xrightarrow{0} 3, 3→023 \xrightarrow{0} 2, 3→ϵ53 \xrightarrow{\epsilon} 5, 4→154 \xrightarrow{1} 5, 5→145 \xrightarrow{1} 4.

      Which one of the following regular expressions represents the language accepted by MM ?

      1. (a) (00)∗+1(11)∗(00)^* + 1(11)^*
      2. (b) 0∗+(1+0(00)∗)(11)∗0^* + (1 + 0(00)^*)(11)^*
      3. (c) (00)∗+(1+(00)∗)(11)∗(00)^* + (1 + (00)^*)(11)^*
      4. (d) 0++1(11)∗+0(11)∗0^+ + 1(11)^* + 0(11)^*
      Show answer

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

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the 5-state DFA MM accepting the language L(M)⊂(0+1)∗L(M) \subset (0 + 1)^* shown below. For any string w∈(0+1)∗w \in (0 + 1)^* let n0(w)n_0(w) be the number of 0′s0's in ww and n1(w)n_1(w) be the number of 1′s1's in ww.

      Transition table of MM (state 1 is the start state and the only accepting state):

      | State | on 0 | on 1 |
      |---|---|---|
      | →*1 | 2 | 4 |
      | 2 | 3 | 1 |
      | 3 | 1 | 2 |
      | 4 | 1 | 5 |
      | 5 | 4 | 1 |

      Which of the following statements is/are FALSE?

      1. (a) States 2 and 4 are distinguishable in MM
      2. (b) States 3 and 4 are distinguishable in MM
      3. (c) States 2 and 5 are distinguishable in MM
      4. (d) Any string ww with n0(w)=n1(w)n_0(w) = n_1(w) is in L(M)L(M)
      Show answer

      ()

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a context-free grammar GG with the following 3 rules.



      S→aS,S→aSbS,S→cS \to aS,\quad S \to aSbS,\quad S \to c




      Let w∈L(G)w \in L(G). Let na(w),nb(w),nc(w)n_a(w), n_b(w), n_c(w) denote the number of times a,b,ca, b, c occur in ww, respectively. Which of the following statements is/are TRUE?

      1. (a) na(w)>nb(w)n_a(w) > n_b(w)
      2. (b) na(w)>nc(w)−2n_a(w) > n_c(w) - 2
      3. (c) nc(w)=nb(w)+1n_c(w) = n_b(w) + 1
      4. (d) nc(w)=nb(w)∗2n_c(w) = n_b(w) * 2
      Show answer

      ()

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Let G=(V,Σ,S,P)G = (V, \Sigma, S, P) be a context-free grammar in Chomsky Normal Form with Σ={a,b,c}\Sigma = \{a, b, c\} and VV containing 10 variable symbols including the start symbol SS. The string w=a30b30c30w = a^{30}b^{30}c^{30} is derivable from SS. The number of steps (application of rules) in the derivation S→∗wS \to^* w is _________

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following two regular expressions over the alphabet {0,1}\{0,1\}:



      r=0∗+1∗r = 0^* + 1^*





      s=01∗+10∗s = 01^* + 10^*




      The total number of strings of length less than or equal to 5, which are neither in rr nor in ss, is _________

    26. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let L1L_1 be the language represented by the regular expression b∗ab∗(ab∗ab∗)∗b^*ab^*(ab^*ab^*)^* and L2={w∈(a+b)∗∣∣w∣≤4}L_2 = \{ w \in (a+b)^* \mid \lvert w\rvert \le 4\}, where ∣w∣\lvert w\rvert denotes the length of string ww. The number of strings in L2L_2 which are also in L1L_1 is ___________

    27. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the Deterministic Finite-state Automaton (DFA) A\mathcal{A} shown below. The DFA runs on the alphabet {0,1}\{0, 1\}, and has the set of states {s,p,q,r}\{s, p, q, r\}, with ss being the start state and pp being the only final state.

      | State | on 0 | on 1 |
      |---|---|---|
      | →s\to s | rr | pp |
      | pp (final) | pp | qq |
      | qq | rr | pp |
      | rr | rr | rr |

      Which one of the following regular expressions correctly describes the language accepted by A\mathcal{A}?

      1. (a) 1(0∗11)∗1(0^*11)^*
      2. (b) 0(0+1)∗0(0 + 1)^*
      3. (c) 1(0+11)∗1(0 + 11)^*
      4. (d) 1(110∗)∗1(110^*)^*
      Show answer

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

    28. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which of the following statements is/are CORRECT?

      1. (a) The intersection of two regular languages is regular.
      2. (b) The intersection of two context-free languages is context-free.
      3. (c) The intersection of two recursive languages is recursive.
      4. (d) The intersection of two recursively enumerable languages is recursively enumerable.
      Show answer

      ()

    29. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the context-free grammar GG below



      S→aSb∣XS \to aSb \mid X





      X→aX∣Xb∣a∣b,X \to aX \mid Xb \mid a \mid b,




      where SS and XX are non-terminals, and aa and bb are terminal symbols. The starting non-terminal is SS.

      Which one of the following statements is CORRECT?

      1. (a) The language generated by GG is (a+b)∗(a + b)^*
      2. (b) The language generated by GG is a∗(a+b)b∗a^*(a + b)b^*
      3. (c) The language generated by GG is a∗b∗(a+b)a^*b^*(a + b)
      4. (d) The language generated by GG is not a regular language
      Show answer

      (b) The language generated by GG is a∗(a+b)b∗a^*(a + b)b^*

    30. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the pushdown automaton (PDA) PP below, which runs on the input alphabet {a,b}\{a, b\}, has stack alphabet {⊥,A}\{\bot, A\}, and has three states {s,p,q}\{s, p, q\}, with ss being the start state. A transition from state uu to state vv, labelled c/X/γc/X/\gamma, where cc is an input symbol or ϵ\epsilon, XX is a stack symbol, and γ\gamma is a string of stack symbols, represents the fact that in state uu, the PDA can read cc from the input, with XX on the top of its stack, pop XX from the stack, push in the string γ\gamma on the stack, and go to state vv. In the initial configuration, the stack has only the symbol ⊥\bot in it. The PDA accepts by empty stack.

      The transitions of PP are:

      - s→ss \to s: a/⊥/A⊥a/\bot/A\bot and a/A/AAa/A/AA
      - s→ps \to p: b/A/ϵb/A/\epsilon
      - p→pp \to p: b/A/ϵb/A/\epsilon
      - s→qs \to q: ϵ/A/ϵ\epsilon/A/\epsilon
      - p→qp \to q: ϵ/A/ϵ\epsilon/A/\epsilon
      - q→qq \to q: ϵ/A/ϵ\epsilon/A/\epsilon and ϵ/⊥/ϵ\epsilon/\bot/\epsilon

      Which one of the following options correctly describes the language accepted by PP?

      1. (a) {ambn∣1≤m and n<m}\{a^mb^n \mid 1 \le m \text{ and } n < m\}
      2. (b) {ambn∣0≤n≤m}\{a^mb^n \mid 0 \le n \le m\}
      3. (c) {ambn∣0≤m and 0≤n}\{a^mb^n \mid 0 \le m \text{ and } 0 \le n\}
      4. (d) {am∣0≤m}∪{bn∣0≤n}\{a^m \mid 0 \le m\} \cup \{b^n \mid 0 \le n\}
      Show answer

      (a) {ambn∣1≤m and n<m}\{a^mb^n \mid 1 \le m \text{ and } n < m\}

    31. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the language LL over the alphabet {0,1}\{0, 1\}, given below:



      L={w∈{0,1}∗∣w does not contain three or more consecutive 1’s}.L = \{w \in \{0, 1\}^* \mid w \text{ does not contain three or more consecutive 1’s}\}.




      The minimum number of states in a Deterministic Finite-State Automaton (DFA) for LL is ____________.

    32. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      The automaton has three states: the start state q0q_0 (not accepting) and two accepting states q1q_1 and q2q_2. Transitions: q0→aq1q_0 \xrightarrow{a} q_1, q1→bq1q_1 \xrightarrow{b} q_1 (self-loop), q1→bq0q_1 \xrightarrow{b} q_0; q0→bq2q_0 \xrightarrow{b} q_2, q2→aq2q_2 \xrightarrow{a} q_2 (self-loop), q2→aq0q_2 \xrightarrow{a} q_0.

      1. (a) ab∗bab∗+ba∗aba∗ab^*bab^* + ba^*aba^*
      2. (b) (ab∗b)∗ab∗+(ba∗a)∗ba∗(ab^*b)^*ab^* + (ba^*a)^*ba^*
      3. (c) (ab∗b+ba∗a)∗(a∗+b∗)(ab^*b + ba^*a)^*(a^* + b^*)
      4. (d) (ba∗a+ab∗b)∗(ab∗+ba∗)(ba^*a + ab^*b)^*(ab^* + ba^*)
      Show answer

      (d) (ba∗a+ab∗b)∗(ab∗+ba∗)(ba^*a + ab^*b)^*(ab^* + ba^*)

    33. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which of the following statements is/are TRUE?

      1. (a) Every subset of a recursively enumerable language is recursive.
      2. (b) If a language LL and its complement L‾\overline{L} are both recursively enumerable, then LL must be recursive.
      3. (c) Complement of a context-free language must be recursive.
      4. (d) If L1L_1 and L2L_2 are regular, then L1∩L2L_1 \cap L_2 must be deterministic context-free.
      Show answer

      ()

    34. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which of the following is/are undecidable?

      1. (a) Given two Turing machines M1M_1 and M2M_2, decide if L(M1)=L(M2)L(M_1) = L(M_2).
      2. (b) Given a Turing machine MM, decide if L(M)L(M) is regular.
      3. (c) Given a Turing machine MM, decide if MM accepts all strings.
      4. (d) Given a Turing machine MM, decide if MM takes more than 1073 steps on every string.
      Show answer

      ()

    35. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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∣,∣x∣>0}L_2 = \{w x w^R \mid w, x \in \{a, b\}^*, \lvert w \rvert, \lvert x \rvert > 0\}

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

      1. (a) L1L_1 and L2L_2 are regular.
      2. (b) L1L_1 and L2L_2 are context-free.
      3. (c) L1L_1 is regular and L2L_2 is context-free.
      4. (d) L1L_1 and L2L_2 are context-free but not regular.
      Show answer

      ()

    36. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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?

      1. (a) L1L_1 is not context-free but L2L_2 and L3L_3 are deterministic context-free.
      2. (b) Neither L1L_1 nor L2L_2 is context-free.
      3. (c) L2L_2, L3L_3 and L2∩L3L_2 \cap L_3 all are context-free.
      4. (d) Neither L1L_1 nor its complement is context-free.
      Show answer

      ()

    37. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      1. (a) L1∩L2L_1 \cap L_2
      2. (b) L1⋅L2L_1 \cdot L_2
      3. (c) L1−L2L_1 - L_2
      4. (d) L1∪L2L_1 \cup L_2
      Show answer

      (c) L1−L2L_1 - L_2

    38. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let L⊆{0,1}∗L \subseteq \{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
      Show answer

      (c) {0,1}∗−L\{0, 1\}^* - L

    39. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      1. (a) L={⟨M⟩∣M is a DFA such that L(M)=∅}L = \{\langle M \rangle \mid M \text{ is a DFA such that } L(M) = \emptyset\}
      2. (b) L={⟨M⟩∣M is a DFA such that L(M)=Σ∗}L = \{\langle M \rangle \mid M \text{ is a DFA such that } L(M) = \Sigma^*\}
      3. (c) L={⟨M⟩∣M is a PDA such that L(M)=∅}L = \{\langle M \rangle \mid M \text{ is a PDA such that } L(M) = \emptyset\}
      4. (d) L={⟨M⟩∣M is a PDA such that L(M)=Σ∗}L = \{\langle M \rangle \mid M \text{ is a PDA such that } L(M) = \Sigma^*\}
      Show answer

      (d) L={⟨M⟩∣M is a PDA such that L(M)=Σ∗}L = \{\langle M \rangle \mid M \text{ is a PDA such that } L(M) = \Sigma^*\}

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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)
      Show answer

      ()

    41. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following deterministic finite automaton (DFA). The number of strings of length 8 accepted by the above automaton is __________.

    42. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following two statements about regular languages:

      S1S_1: Every infinite regular language contains an undecidable language as a subset.
      S2S_2: Every finite language is regular.

      Which one of the following choices is correct?

      1. (a) Only S1S_1 is true.
      2. (b) Only S2S_2 is true.
      3. (c) Both S1S_1 and S2S_2 are true.
      4. (d) Neither S1S_1 nor S2S_2 is true.
      Show answer

      (c) Both S1S_1 and S2S_2 are true.

    43. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following language.



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




      Which one of the following deterministic finite automata accepts LL?

      [In every option the DFA has four states drawn left to right, here called q0q_0 (start), q1q_1, q2q_2 and q3q_3 (the only accepting state). In all four, q0→1q0q_0 \xrightarrow{1} q_0, q0→0q1q_0 \xrightarrow{0} q_1, q1→0q1q_1 \xrightarrow{0} q_1, q1→1q2q_1 \xrightarrow{1} q_2, q2→0q1q_2 \xrightarrow{0} q_1 and q2→1q3q_2 \xrightarrow{1} q_3. The options differ only in the transitions out of q3q_3.]

      1. (a) q3→1q3q_3 \xrightarrow{1} q_3, q3→0q1q_3 \xrightarrow{0} q_1
      2. (b) q3→0,1q3q_3 \xrightarrow{0,1} q_3
      3. (c) q3→1q2q_3 \xrightarrow{1} q_2, q3→0q1q_3 \xrightarrow{0} q_1
      4. (d) q3→1q0q_3 \xrightarrow{1} q_0, q3→0q1q_3 \xrightarrow{0} q_1
      Show answer

      (d) q3→1q0q_3 \xrightarrow{1} q_0, q3→0q1q_3 \xrightarrow{0} q_1

    44. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

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

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

      Which one of the following options is correct?

      1. (a) Both L1L_1 and L2L_2 are decidable.
      2. (b) L1L_1 is decidable and L2L_2 is undecidable.
      3. (c) L1L_1 is undecidable and L2L_2 is decidable.
      4. (d) Both L1L_1 and L2L_2 are undecidable.
      Show answer

      (a) Both L1L_1 and L2L_2 are decidable.

    45. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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\}^*\}
      Show answer

      ()

    46. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string ϵ\epsilon 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)^*
      Show answer

      ()

    47. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      In a pushdown automaton P=(Q,Σ,Γ,δ,q0,F)P = (Q, \Sigma, \Gamma, \delta, q_0, F), a transition of the form,



      p→a, X→Yqp \xrightarrow{a,\ X \rightarrow Y} q




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



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




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

      [States q0q_0 (start), q1q_1, q2q_2, q3q_3 (accepting). Transitions: q0→ϵ, ϵ→#q1q_0 \xrightarrow{\epsilon,\ \epsilon \rightarrow \#} q_1; loop on q1q_1 labelled a,ϵ→Aa, \epsilon \rightarrow A; q1→ϵ, ϵ→ϵq2q_1 \xrightarrow{\epsilon,\ \epsilon \rightarrow \epsilon} q_2; loop on q2q_2 labelled b,A→ϵb, A \rightarrow \epsilon; q2→ϵ, A→Aq3q_2 \xrightarrow{\epsilon,\ A \rightarrow A} q_3.]

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

    48. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following regular expressions represents the set of all binary strings with an odd number of 1's?

      1. (a) ((0+1)∗1(0+1)∗1)∗10∗((0+1)^*1(0+1)^*1)^*10^*
      2. (b) (0∗10∗10∗)∗0∗1(0^*10^*10^*)^*0^*1
      3. (c) 10∗(0∗10∗10∗)∗10^*(0^*10^*10^*)^*
      4. (d) (0∗10∗10∗)∗10∗(0^*10^*10^*)^*10^*
    49. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following statements.

      I. If L1∪L2L_1 \cup L_2 is regular, then both L1L_1 and L2L_2 must be regular.

      II. The class of regular languages is closed under infinite union.

      Which of the above statements is/are TRUE?

      1. (a) I only
      2. (b) II only
      3. (c) Both I and II
      4. (d) Neither I nor II
      Show answer

      (d) Neither I nor II

    50. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the language L={an∣n≥0}∪{anbn∣n≥0}L = \{a^n \mid n \ge 0\} \cup \{a^nb^n \mid n \ge 0\} and the following statements.

      I. LL is deterministic context-free.

      II. LL is context-free but not deterministic context-free.

      III. LL is not LL(kk) for any kk.

      Which of the above statements is/are TRUE?

      1. (a) I only
      2. (b) II only
      3. (c) I and III only
      4. (d) III only
      Show answer

      (c) I and III only

    51. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which of the following languages are undecidable? Note that ⟨M⟩\langle M \rangle indicates encoding of the Turing machine M.

      L1={⟨M⟩∣L(M)=∅}L_1 = \{\langle M \rangle \mid L(M) = \emptyset\}

      L2={⟨M,w,q⟩∣M on input w reaches state q in exactly 100 steps}L_2 = \{\langle M, w, q \rangle \mid M \text{ on input } w \text{ reaches state } q \text{ in exactly 100 steps}\}

      L3={⟨M⟩∣L(M) is not recursive}L_3 = \{\langle M \rangle \mid L(M) \text{ is not recursive}\}

      L4={⟨M⟩∣L(M) contains at least 21 members}L_4 = \{\langle M \rangle \mid L(M) \text{ contains at least 21 members}\}

      1. (a) L1L_1, L3L_3, and L4L_4 only
      2. (b) L1L_1 and L3L_3 only
      3. (c) L2L_2 and L3L_3 only
      4. (d) L2L_2, L3L_3, and L4L_4 only
      Show answer

      (a) L1L_1, L3L_3, and L4L_4 only

    52. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following languages.

      L1={wxyx∣w,x,y∈(0+1)+}L_1 = \{wxyx \mid w, x, y \in (0+1)^+\}

      L2={xy∣x,y∈(a+b)∗,∣x∣=∣y∣,x≠y}L_2 = \{xy \mid x, y \in (a+b)^*, \lvert x \rvert = \lvert y \rvert, x \ne y\}

      Which one of the following is TRUE?

      1. (a) L1L_1 is regular and L2L_2 is context-free.
      2. (b) L1L_1 is context-free but not regular and L2L_2 is context-free.
      3. (c) Neither L1L_1 nor L2L_2 is context-free.
      4. (d) L1L_1 is context-free but L2L_2 is not context-free.
      Show answer

      (a) L1L_1 is regular and L2L_2 is context-free.

    53. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following language.



      L={x∈{a,b}∗∣number of a’s in x is divisible by 2 but not divisible by 3}L = \{x \in \{a,b\}^* \mid \text{number of } a\text{'s in } x \text{ is divisible by 2 but not divisible by 3}\}




      The minimum number of states in a DFA that accepts LL is \_\_\_\_\_\_.

    54. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      If LL is a regular language over Σ={a,b}\Sigma = \{a, b\}, which one of the following languages is NOT regular ?

      1. (a) L⋅LR={xy∣x∈L,yR∈L}L \cdot L^{R} = \{xy \mid x \in L, y^{R} \in L\}
      2. (b) {wwR∣w∈L}\{ww^{R} \mid w \in L\}
      3. (c) Prefix(L)={x∈Σ∗∣∃y∈Σ∗ such that xy∈L}\mathrm{Prefix}(L) = \{x \in \Sigma^* \mid \exists y \in \Sigma^* \text{ such that } xy \in L\}
      4. (d) Suffix(L)={y∈Σ∗∣∃x∈Σ∗ such that xy∈L}\mathrm{Suffix}(L) = \{y \in \Sigma^* \mid \exists x \in \Sigma^* \text{ such that } xy \in L\}
      Show answer

      (b) {wwR∣w∈L}\{ww^{R} \mid w \in L\}

    55. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      For Σ={a,b}\Sigma = \{a, b\}, let us consider the regular language L={x∣x=a2+3k or x=b10+12k,k≥0}L = \{x \mid x = a^{2+3k} \text{ or } x = b^{10+12k}, k \ge 0\}. Which one of the following can be a pumping length (the constant guaranteed by the pumping lemma) for LL ?

      1. (a) 3
      2. (b) 5
      3. (c) 9
      4. (d) 24
      Show answer

      (d) 24

    56. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which one of the following languages over Σ={a,b}\Sigma = \{a, b\} is NOT context-free?

      1. (a) {wwR∣w∈{a,b}∗}\{ww^{R} \mid w \in \{a, b\}^*\}
      2. (b) {wanbnwR∣w∈{a,b}∗,n≥0}\{wa^{n}b^{n}w^{R} \mid w \in \{a, b\}^*, n \ge 0\}
      3. (c) {wanwRbn∣w∈{a,b}∗,n≥0}\{wa^{n}w^{R}b^{n} \mid w \in \{a, b\}^*, n \ge 0\}
      4. (d) {anbi∣i∈{n,3n,5n},n≥0}\{a^{n}b^{i} \mid i \in \{n, 3n, 5n\}, n \ge 0\}
      Show answer

      (c) {wanwRbn∣w∈{a,b}∗,n≥0}\{wa^{n}w^{R}b^{n} \mid w \in \{a, b\}^*, n \ge 0\}

    57. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following sets: S1. Set of all recursively enumerable languages over the alphabet {0,1} S2. Set of all syntactically valid C programs S3. Set of all languages over the alphabet {0,1} S4. Set of all non-regular languages over the alphabet {0,1} Which of the above sets are uncountable?

      1. (a) S1 and S2
      2. (b) S3 and S4
      3. (c) S2 and S3
      4. (d) S1 and S4
      Show answer

      (b) S3 and S4

    58. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let Σ\Sigma be the set of all bijections from {1,…,5}\{1, \ldots, 5\} to {1,…,5}\{1, \ldots, 5\}, where id\mathit{id} denotes the identity function, i.e. id(j)=j,∀j\mathit{id}(j) = j, \forall j. Let ∘\circ denote composition on functions. For a string x=x1x2⋯xn∈Σnx = x_1 x_2 \cdots x_n \in \Sigma^n, n≥0n \ge 0, let π(x)=x1∘x2∘⋯∘xn\pi(x) = x_1 \circ x_2 \circ \cdots \circ x_n. Consider the language L={x∈Σ∗∣π(x)=id}L = \{x \in \Sigma^* \mid \pi(x) = \mathit{id}\}. The minimum number of states in any DFA accepting LL is ________.

  8. 11Compiler design4 ch · 1 h 7 min50 PYQ
    1. Lexical analysis 16′
    2. Parsing: top-down and bottom-up 18′
    3. Syntax-directed translation and intermediate code 15′
    4. Runtime environments and optimisation 18′
    See the 50 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      1. (a) A static variable declared inside a function
      2. (b) An array of integers declared inside a function
      3. (c) A dynamically allocated array of integers created using malloc() function call
      4. (d) Return address of a function
      Show answer

      (c) A dynamically allocated array of integers created using malloc() function call

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider the following C statements: ``` char *str1 = "Hello; /* Statement S1 */ char *str2 = "Hello;"; /* Statement S2 */ int *str3 = "Hello"; /* Statement S3 */ ``` Which of the following options is/are correct?

      1. (a) S1 and S2 have syntactic errors
      2. (b) S2 has a lexical error and S3 has a syntactic error
      3. (c) S1 has a lexical error and S3 has a semantic error
      4. (d) S1 has a syntactic error and S3 has a semantic error
      Show answer

      (c) S1 has a lexical error and S3 has a semantic error

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Which of the following statements is/are true?

      1. (a) LL(1) parser uses backtracking
      2. (b) For a grammar to be LL(1), it must be left-recursive
      3. (c) For a grammar to be LL(1), it must be left-factored
      4. (d) The LL(1) parsers are more powerful than the SLR parsers
      Show answer

      (c) For a grammar to be LL(1), it must be left-factored

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      A lexical analyzer uses the following token definitions



      letter→[A−Za−z]\mathit{letter} \to [A - Za - z]





      digit→[0−9]\mathit{digit} \to [0 - 9]





      id→letter (letter∣digit)∗\mathit{id} \to \mathit{letter}\ (\mathit{letter} \mid \mathit{digit})^*





      number→digit+\mathit{number} \to \mathit{digit}^+





      ws→(blank∣tab∣newline)+\mathit{ws} \to (\mathit{blank} \mid \mathit{tab} \mid \mathit{newline})^+




      For the string given below,



      x123mm78y7zzz514A8HAaYcDx1 \quad 23mm \quad 78 \quad y \quad 7z \quad zz5 \quad 14A \quad 8H \quad AaYcD




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

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      Consider the canonical LR(0)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 \to ACB





      A→aA∣ϵA \to aA \mid \epsilon





      C→cC∣ϵC \to cC \mid \epsilon





      B→bB∣bB \to bB \mid b




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

      1. (a) 2
      2. (b) 3
      3. (c) 4
      4. (d) 5
      Show answer

      (d) 5

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the control flow graph shown in the figure.

      (ENTRY → B1; B1 → B2 and B1 → B3; B2 → B4 and B3 → B4; B4 → B5; B5 → EXIT)

      | Block | Statements |
      |---|---|
      | B1 | a=b+ia = b + i |
      | B2 | a=g∗ka = g * k; f=d−ff = d - f; a=c∗4a = c * 4 |
      | B3 | t=g∗kt = g * k; b=c+mb = c + m |
      | B4 | x=g∗kx = g * k; y=b+iy = b + i |
      | B5 | z=c+mz = c + m |

      Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5?

      *Note:* All the variables are integers.

      1. (a) B4: {b+i}\{ b + i \}
        B5: {c+m}\{ c + m \}
      2. (b) B4: {g∗k}\{ g * k \}
        B5: {c+m}\{ c + m \}
      3. (c) B4: {g∗k, b+i}\{ g * k,\ b + i \}
        B5: {}\{ \}
      4. (d) B4: {g∗k}\{ g * k \}
        B5: {}\{ \}
      Show answer

      (d) B4: {g∗k}\{ g * k \}
      B5: {}\{ \}

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      Consider the control flow graph given below. Control flow graph: ENTRY → B1; B1: a = b + c; B1 → B2 and B1 → B3; B2: d = a + e; B2 → B4; B3: e = a + f; B3 → B1; B4: g = d + e; B4 → EXIT. Which one of the following options is the set of live variables at the exit point of each basic block?

      1. (a) B1:{a, b, c, e, f}, B2:{d, e}, B3:{b, c, e, f}, B4:∅
      2. (b) B1:∅, B2:{d, e}, B3:{a, c, f}, B4:∅
      3. (c) B1:{a, b, c, e, f}, B2:{d, e}, B3:{c, e, f}, B4:∅
      4. (d) B1:∅, B2:{d, e, f}, B3:{a, b, c, e, f}, B4:∅
      Show answer

      (a) B1:{a, b, c, e, f}, B2:{d, e}, B3:{b, c, e, f}, B4:∅

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.

      SDD1

      | Grammar (G1) | Semantic Rules |
      |---|---|
      | D→T VD \to T\ V | D.type=T.typeD.\mathit{type} = T.\mathit{type}; V.type=T.typeV.\mathit{type} = T.\mathit{type} |
      | T→intT \to \mathit{int} | T.type=intT.\mathit{type} = \mathit{int} |
      | T→floatT \to \mathit{float} | T.type=floatT.\mathit{type} = \mathit{float} |
      | V→V1 idV \to V_1\ \mathit{id} | V1.type=V.typeV_1.\mathit{type} = V.\mathit{type}; put(id.entry,V.type)\mathit{put}(\mathit{id}.\mathit{entry}, V.\mathit{type}) |
      | V→idV \to \mathit{id} | put(id.entry,V.type)\mathit{put}(\mathit{id}.\mathit{entry}, V.\mathit{type}) |

      SDD2

      | Grammar (G2) | Semantic Rules |
      |---|---|
      | D→D1 idD \to D_1\ \mathit{id} | D.type=D1.typeD.\mathit{type} = D_1.\mathit{type}; put(id.entry,D1.type)\mathit{put}(\mathit{id}.\mathit{entry}, D_1.\mathit{type}) |
      | D→T idD \to T\ \mathit{id} | D.type=T.typeD.\mathit{type} = T.\mathit{type}; put(id.entry,T.type)\mathit{put}(\mathit{id}.\mathit{entry}, T.\mathit{type}) |
      | T→intT \to \mathit{int} | T.type=intT.\mathit{type} = \mathit{int} |
      | T→floatT \to \mathit{float} | T.type=floatT.\mathit{type} = \mathit{float} |

      DD is the start symbol, and int\mathit{int}, float\mathit{float} and id\mathit{id} are the three terminals. The non-terminal V1V_1 is the same as VV and the non-terminal D1D_1 is the same as DD. Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function put\mathit{put} updates the symbol table with the type information for an identifier.

      Let P and Q be the languages specified by grammars G1 and G2, respectively.

      Which of the following statements is/are true?

      1. (a) The languages P and Q are the same
      2. (b) SDD2 is S-attributed and contains only synthesized attributes
      3. (c) SDD1 is L-attributed and contains only inherited attributes
      4. (d) The specifications of SDD1 and SDD2 are such that the same entries get added to the symbol table
      Show answer

      ()

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which ONE of the following statements is FALSE regarding the symbol table?

      1. (a) Symbol table is responsible for keeping track of the scope of variables.
      2. (b) Symbol table can be implemented using a binary search tree.
      3. (c) Symbol table is not required after the parsing phase.
      4. (d) Symbol table is created during the lexical analysis phase.
      Show answer

      (c) Symbol table is not required after the parsing phase.

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which ONE of the following techniques used in compiler code optimization uses live variable analysis?

      1. (a) Run-time function call management
      2. (b) Register assignment to variables
      3. (c) Strength reduction
      4. (d) Constant folding
      Show answer

      (b) Register assignment to variables

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following statements about the use of backpatching in a compiler for intermediate code generation: (I) Backpatching can be used to generate code for Boolean expression in one pass. (II) Backpatching can be used to generate code for flow-of-control statements in one pass. Which ONE of the following options is CORRECT?

      1. (a) Only (I) is correct.
      2. (b) Only (II) is correct.
      3. (c) Both (I) and (II) are correct.
      4. (d) Neither (I) nor (II) is correct.
      Show answer

      (c) Both (I) and (II) are correct.

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Given the following syntax directed translation rules:

      Rule 1: R→AB {B.i=R.i−1; A.i=B.i; R.i=A.i+1;}R \rightarrow AB\ \{B.i = R.i - 1;\ A.i = B.i;\ R.i = A.i + 1;\}

      Rule 2: P→CD {P.i=C.i+D.i; D.i=C.i+2;}P \rightarrow CD\ \{P.i = C.i + D.i;\ D.i = C.i + 2;\}

      Rule 3: Q→EF {Q.i=E.i+F.i;}Q \rightarrow EF\ \{Q.i = E.i + F.i;\}

      Which ONE is the CORRECT option among the following?

      1. (a) Rule 1 is S-attributed and L-attributed; Rule 2 is S-attributed and not L-attributed; Rule 3 is neither S-attributed nor L-attributed
      2. (b) Rule 1 is neither S-attributed nor L-attributed; Rule 2 is S-attributed and L-attributed; Rule 3 is S-attributed and L-attributed
      3. (c) Rule 1 is neither S-attributed nor L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
      4. (d) Rule 1 is S-attributed and not L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
      Show answer

      (c) Rule 1 is neither S-attributed nor L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Given a Context-Free Grammar GG as follows:

      S→Aa∣bAc∣dc∣bdaS \rightarrow Aa \mid bAc \mid dc \mid bda

      A→dA \rightarrow d

      Which ONE of the following statements is TRUE?

      1. (a) GG is neither LALR(1) nor SLR(1)
      2. (b) GG is CLR(1), not LALR(1)
      3. (c) GG is LALR(1), not SLR(1)
      4. (d) GG is LALR(1), also SLR(1)
      Show answer

      (c) GG is LALR(1), not SLR(1)

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?

      1. (a) For a production A→ϵA \to \epsilon, ϵ\epsilon will be added to First(A)\mathit{First}(A).
      2. (b) If there is any input right end marker, it will be added to First(S)\mathit{First}(S), where SS is the start symbol.
      3. (c) For a production A→ϵA \to \epsilon, ϵ\epsilon will be added to Follow(A)\mathit{Follow}(A).
      4. (d) If there is any input right end marker, it will be added to Follow(S)\mathit{Follow}(S), where SS is the start symbol.
      Show answer

      ()

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider two grammars G1G_1 and G2G_2 with the production rules given below:

      G1G_1: S→if E then S∣if E then S else S∣aS \rightarrow if\ E\ then\ S \mid if\ E\ then\ S\ else\ S \mid a

        E→b\quad\ \ E \rightarrow b

      G2G_2: S→if E then S∣MS \rightarrow if\ E\ then\ S \mid M

        M→if E then M else S∣c\quad\ \ M \rightarrow if\ E\ then\ M\ else\ S \mid c

        E→b\quad\ \ E \rightarrow b

      where ifif, thenthen, elseelse, aa, bb, cc are the terminals.

      Which of the following option(s) is/are CORRECT?

      1. (a) G1G_1 is not LL(1)LL(1) and G2G_2 is LL(1)LL(1).
      2. (b) G1G_1 is LL(1)LL(1) and G2G_2 is not LL(1)LL(1).
      3. (c) G1G_1 and G2G_2 are not LL(1)LL(1).
      4. (d) G1G_1 and G2G_2 are ambiguous.
      Show answer

      ()

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is ________. (Answer in integer) ``` 1001: i = 1 1002: j = 1 1003: t1 = 10*i 1004: t2 = t1+j 1005: t3 = 8*t2 1006: t4 = t3-88 1007: a[t4] = 0.0 1008: j = j+1 1009: if j <= 10 goto 1003 1010: i = i+1 1011: if i <= 10 goto 1002 1012: i = 1 1013: t5 = i-1 1014: t6 = 88*t5 1015: a[t6] = 1.0 1016: i = i+1 1017: if i <= 10 goto 1013 ```

    17. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following two sets: | Set X | Set Y | |---|---| | P. Lexical Analyzer | 1. Abstract Syntax Tree | | Q. Syntax Analyzer | 2. Token | | R. Intermediate Code Generator | 3. Parse Tree | | S. Code Optimizer | 4. Constant Folding | Which one of the following options is the CORRECT match from Set X to Set Y ?

      1. (a) P – 4; Q – 1; R – 3; S – 2
      2. (b) P – 2; Q – 3; R – 1; S – 4
      3. (c) P – 2; Q – 1; R – 3; S – 4
      4. (d) P – 4; Q – 3; R – 2; S – 1
      Show answer

      (b) P – 2; Q – 3; R – 1; S – 4

    18. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following is/are Bottom-Up Parser(s)?

      1. (a) Shift-reduce Parser
      2. (b) Predictive Parser
      3. (c) LL(1) Parser
      4. (d) LR Parser
      Show answer

      ()

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following statements is/are FALSE?

      1. (a) An attribute grammar is a syntax-directed definition (SDD) in which the functions in the semantic rules have no side effects
      2. (b) The attributes in a L-attributed definition cannot always be evaluated in a depth-first order
      3. (c) Synthesized attributes can be evaluated by a bottom-up parser as the input is parsed
      4. (d) All L-attributed definitions based on LR(1) grammar can be evaluated using a bottom-up parsing strategy
      Show answer

      ()

    20. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following syntax-directed definition (SDD).

      | Production | Semantic rule |
      |---|---|
      | S→DHTUS \to DHTU | {S.val=D.val+H.val+T.val+U.val;}\{ S.val = D.val + H.val + T.val + U.val; \} |
      | D→"M"D1D \to \text{"M"}D_1 | {D.val=5+D1.val;}\{ D.val = 5 + D_1.val; \} |
      | D→ϵD \to \epsilon | {D.val=−5;}\{ D.val = -5; \} |
      | H→"L"H1H \to \text{"L"}H_1 | {H.val=5∗10+H1.val;}\{ H.val = 5 * 10 + H_1.val; \} |
      | H→ϵH \to \epsilon | {H.val=−10;}\{ H.val = -10; \} |
      | T→"C"T1T \to \text{"C"}T_1 | {T.val=5∗100+T1.val;}\{ T.val = 5 * 100 + T_1.val; \} |
      | T→ϵT \to \epsilon | {T.val=−5;}\{ T.val = -5; \} |
      | U→"K"U \to \text{"K"} | {U.val=5;}\{ U.val = 5; \} |

      Given "MMLK" as the input, which one of the following options is the CORRECT value computed by the SDD (in the attribute S.valS.val)?

      1. (a) 45
      2. (b) 50
      3. (c) 55
      4. (d) 65
      Show answer

      (a) 45

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following grammar GG, with SS as the start symbol. The grammar GG has three incomplete productions denoted by (1), (2), and (3).



      S→daT∣ (1) ‾S \to daT \mid \underline{\ (1)\ }





      T→aS∣bT∣ (2) ‾T \to aS \mid bT \mid \underline{\ (2)\ }





      R→ (3) ‾∣ϵR \to \underline{\ (3)\ } \mid \epsilon




      The set of terminals is {a,b,c,d,f}\{a, b, c, d, f\}. The FIRST and FOLLOW sets of the different non-terminals are as follows.

      FIRST$(S) = \{c, d, f\},FIRST, FIRST(T) = \{a, b, \epsilon\},FIRST, FIRST(R) = \{c, \epsilon\}$

      FOLLOW$(S)$ = FOLLOW$(T) = \{c, f, \$\},FOLLOW, FOLLOW(R) = \{f\}$

      Which one of the following options CORRECTLY fills in the incomplete productions?

      1. (a) (1) S→RfS \to Rf (2) T→ϵT \to \epsilon (3) R→cTRR \to cTR
      2. (b) (1) S→fRS \to fR (2) T→ϵT \to \epsilon (3) R→cTRR \to cTR
      3. (c) (1) S→fRS \to fR (2) T→cTT \to cT (3) R→cRR \to cR
      4. (d) (1) S→RfS \to Rf (2) T→cTT \to cT (3) R→cRR \to cR
      Show answer

      (a) (1) S→RfS \to Rf (2) T→ϵT \to \epsilon (3) R→cTRR \to cTR

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following pseudo-code. ``` L1: t1 = -1 L2: t2 = 0 L3: t3 = 0 L4: t4 = 4 * t3 L5: t5 = 4 * t2 L6: t6 = t5 * M L7: t7 = t4 + t6 L8: t8 = a[t7] L9: if t8 <= max goto L11 L10: t1 = t8 L11: t3 = t3 + 1 L12: if t3 < M goto L4 L13: t2 = t2 + 1 L14: if t2 < N goto L3 L15: max = t1 ``` Which one of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively ?

      1. (a) 6 and 6
      2. (b) 6 and 7
      3. (c) 7 and 7
      4. (d) 7 and 6
      Show answer

      (d) 7 and 6

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following context-free grammar where the start symbol is SS and the set of terminals is {a,b,c,d}\{a,b,c,d\}.



      S→AaAb∣BbBaS \to AaAb \mid BbBa





      A→cS∣ϵA \to cS \mid \epsilon





      B→dS∣ϵB \to dS \mid \epsilon




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

      | | aa | bb | cc | dd | $\$ |
      |---|---|---|---|---|---|
      | SS | S→AaAbS \to AaAb | S→BbBaS \to BbBa | (1) | (2) | |
      | AA | A→ϵA \to \epsilon | (3) | A→cSA \to cS | | |
      | BB | (4) | B→ϵB \to \epsilon | | B→dSB \to dS | |

      Which one of the following options represents the CORRECT combination for the numbered cells in the parsing table?

      Note: In the options, “blank” denotes that the corresponding cell is empty.

      1. (a) (1) S→AaAbS \to AaAb (2) S→BbBaS \to BbBa (3) A→ϵA \to \epsilon (4) B→ϵB \to \epsilon
      2. (b) (1) S→BbBaS \to BbBa (2) S→AaAbS \to AaAb (3) A→ϵA \to \epsilon (4) B→ϵB \to \epsilon
      3. (c) (1) S→AaAbS \to AaAb (2) S→BbBaS \to BbBa (3) blank (4) blank
      4. (d) (1) S→BbBaS \to BbBa (2) S→AaAbS \to AaAb (3) blank (4) blank
      Show answer

      (a) (1) S→AaAbS \to AaAb (2) S→BbBaS \to BbBa (3) A→ϵA \to \epsilon (4) B→ϵB \to \epsilon

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following expression: x[i]=(p+r)∗−s[i]+u/wx[i] = (p + r) * -s[i] + u/w. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).

      | | op | arg1 | arg2 |
      |---|---|---|---|
      | (0) | + | pp | rr |
      | (1) | | | |
      | (2) | uminus | (1) | |
      | (3) | | | |
      | (4) | / | uu | ww |
      | (5) | + | (3) | (4) |
      | (6) | | | |
      | (7) | = | (6) | (5) |

      Which one of the following options fills in the missing entries CORRECTLY?

      1. (a) (1) =[] ss ii (3) * (0) (2) (6) []= xx ii
      2. (b) (1) []= ss ii (3) – (0) (2) (6) =[] xx (5)
      3. (c) (1) =[] ss ii (3) * (0) (2) (6) []= xx (5)
      4. (d) (1) []= ss ii (3) – (0) (2) (6) =[] xx ii
      Show answer

      (a) (1) =[] ss ii (3) * (0) (2) (6) []= xx ii

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is {a,b,c,d,#,@}\{a,b,c,d,\#,@\}



      S′→SS' \to S





      S→SS∣Aa∣bAc∣Bc∣bBaS \to SS \mid Aa \mid bAc \mid Bc \mid bBa





      A→d#A \to d\#





      B→@B \to @




      Let I0=CLOSURE({S′→∙S})I_0 = \mathit{CLOSURE}(\{S' \to \bullet S\}). The number of items in the set GOTO(I0,S)\mathit{GOTO}(I_0, S) is ___________

    26. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following statements regarding the front-end and back-end of a compiler. **S1**: The front-end includes phases that are independent of the target hardware. **S2**: The back-end includes phases that are specific to the target hardware. **S3**: The back-end includes phases that are specific to the programming language used in the source code. Identify the CORRECT option.

      1. (a) Only **S1** is TRUE.
      2. (b) Only **S1** and **S2** are TRUE.
      3. (c) **S1**, **S2**, and **S3** are all TRUE.
      4. (d) Only **S1** and **S3** are TRUE.
      Show answer

      (b) Only **S1** and **S2** are TRUE.

    27. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following definition of a lexical token id for an identifier in a programming language, using extended regular expressions:



      letter→[A-Za-z]digit→[0-9]id→letter (letter∣digit)∗\begin{aligned} \textbf{letter} &\to \texttt{[A-Za-z]} \\ \textbf{digit} &\to \texttt{[0-9]} \\ \textbf{id} &\to \textbf{letter}\ (\textbf{letter} \mid \textbf{digit})^* \end{aligned}




      Which one of the following Non-deterministic Finite-state Automata with ϵ\epsilon-transitions accepts the set of valid identifiers? (A double-circle denotes a final state)

      1. (a) NFA: start →letter\xrightarrow{\text{letter}} final state FF; also start →ϵ\xrightarrow{\epsilon} FF; FF has a self-loop on letter, digit.
      2. (b) NFA: start →letter\xrightarrow{\text{letter}} final state FF; F→ϵF \xrightarrow{\epsilon} final state GG with a self-loop on letter; F→ϵF \xrightarrow{\epsilon} final state HH with a self-loop on digit.
      3. (c) NFA: start →letter\xrightarrow{\text{letter}} final state FF; F→ϵs1→letters2→ϵs5F \xrightarrow{\epsilon} s_1 \xrightarrow{\text{letter}} s_2 \xrightarrow{\epsilon} s_5; F→ϵs3→digits4→ϵs5F \xrightarrow{\epsilon} s_3 \xrightarrow{\text{digit}} s_4 \xrightarrow{\epsilon} s_5; s5→ϵFs_5 \xrightarrow{\epsilon} F.
      4. (d) NFA: start →letter\xrightarrow{\text{letter}} final state FF; F→letters1→digits2F \xrightarrow{\text{letter}} s_1 \xrightarrow{\text{digit}} s_2; s2→ϵFs_2 \xrightarrow{\epsilon} F.
      Show answer

      (c) NFA: start →letter\xrightarrow{\text{letter}} final state FF; F→ϵs1→letters2→ϵs5F \xrightarrow{\epsilon} s_1 \xrightarrow{\text{letter}} s_2 \xrightarrow{\epsilon} s_5; F→ϵs3→digits4→ϵs5F \xrightarrow{\epsilon} s_3 \xrightarrow{\text{digit}} s_4 \xrightarrow{\epsilon} s_5; s5→ϵFs_5 \xrightarrow{\epsilon} F.

    28. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following program: ```c int main() { f1(); f2(2); f3(); return(0); } int f1() { return(1); } int f2(int X) { f3(); if (X==1) return f1(); else return (X*f2(X-1)); } int f3() { return(5); } ``` Which one of the following options represents the activation tree corresponding to the main function?

      1. (a) main has children f1, f2, f3; that f2 has children f3, f2; the inner f2 has children f3, f1
      2. (b) main has children f1, f2, f3; that f2 has children f3, f1
      3. (c) main has child f1; f1 has child f2; f2 has children f3, f1
      4. (d) main has children f1, f2, f3; that f2 has children f3, f2, f1
      Show answer

      (a) main has children f1, f2, f3; that f2 has children f3, f2; the inner f2 has children f3, f1

    29. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the control flow graph shown. The graph has basic blocks: - B1: `i = m - 1`, `j = n`, `a = 10` - B2: `i = i + 1`, `j = j - 1` - B3: `a = 20` - B4: `i = a + 1` Edges: ENTRY → B1, B1 → B2, B2 → B3, B2 → B4, B3 → B4, B4 → B2, B4 → EXIT. Which one of the following choices correctly lists the set of *live* variables at the exit point of each basic block?

      1. (a) B1: {}, B2: {a}, B3: {a}, B4: {a}
      2. (b) B1: {i, j}, B2: {a}, B3: {a}, B4: {i}
      3. (c) B1: {a, i, j}, B2: {a, i, j}, B3: {a, i}, B4: {a}
      4. (d) B1: {a, i, j}, B2: {a, j}, B3: {a, j}, B4: {a, i, j}
      Show answer

      (d) B1: {a, i, j}, B2: {a, j}, B3: {a, j}, B4: {a, i, j}

    30. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the syntax directed translation given by the following grammar and semantic rules. Here NN, II, FF and BB are non-terminals. NN is the starting non-terminal, and #, 0 and 1 are lexical tokens corresponding to input letters “#”, “0” and “1”, respectively. X.valX.\mathit{val} denotes the synthesized attribute (a numeric value) associated with a non-terminal XX. I1I_1 and F1F_1 denote occurrences of II and FF on the right hand side of a production, respectively. For the tokens 0 and 1, 0.val=0\mathbf{0}.\mathit{val} = 0 and 1.val=1\mathbf{1}.\mathit{val} = 1.

      | Production | Semantic rule |
      |---|---|
      | N→I # FN \to I\ \#\ F | N.val=I.val+F.valN.\mathit{val} = I.\mathit{val} + F.\mathit{val} |
      | I→I1 BI \to I_1\ B | I.val=(2 I1.val)+B.valI.\mathit{val} = (2\ I_1.\mathit{val}) + B.\mathit{val} |
      | I→BI \to B | I.val=B.valI.\mathit{val} = B.\mathit{val} |
      | F→B F1F \to B\ F_1 | F.val=12(B.val+F1.val)F.\mathit{val} = \dfrac{1}{2}(B.\mathit{val} + F_1.\mathit{val}) |
      | F→BF \to B | F.val=12B.valF.\mathit{val} = \dfrac{1}{2}B.\mathit{val} |
      | B→0B \to \mathbf{0} | B.val=0.valB.\mathit{val} = \mathbf{0}.\mathit{val} |
      | B→1B \to \mathbf{1} | B.val=1.valB.\mathit{val} = \mathbf{1}.\mathit{val} |

      The value computed by the translation scheme for the input string



      10#01110\#011




      is ____________. (Rounded off to three decimal places)

    31. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following statements is TRUE?

      1. (a) The LALR(1)\mathit{LALR}(1) parser for a grammar GG cannot have reduce-reduce conflict if the LR(1)\mathit{LR}(1) parser for GG does not have reduce-reduce conflict.
      2. (b) Symbol table is accessed only during the lexical analysis phase.
      3. (c) Data flow analysis is necessary for run-time memory management.
      4. (d) LR(1)\mathit{LR}(1) parsing is sufficient for deterministic context-free languages.
      Show answer

      (d) LR(1)\mathit{LR}(1) parsing is sufficient for deterministic context-free languages.

    32. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the augmented grammar with {+,∗,(,),id}\{+, *, (, ), \mathit{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 \mathit{id}




      If I0I_0 is the set of two LR(0)\mathit{LR}(0) items {[S′→S∙],[S→S∙+R]}\{[S' \to S\bullet], [S \to S\bullet + R]\}, then goto(closure(I0),+)\mathit{goto}(\mathit{closure}(I_0), +) contains exactly __________ items.

    33. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following grammar along with translation rules.



      S→S1#T{S∙val=S1∙val∗T∙val}S \to S_1 \# T \qquad \{S_{\bullet val} = S_{1\bullet val} * T_{\bullet val}\}





      S→T{S∙val=T∙val}S \to T \qquad \{S_{\bullet val} = T_{\bullet val}\}





      T→T1%R{T∙val=T1∙val÷R∙val}T \to T_1 \% R \qquad \{T_{\bullet val} = T_{1\bullet val} \div R_{\bullet val}\}





      T→R{T∙val=R∙val}T \to R \qquad \{T_{\bullet val} = R_{\bullet val}\}





      R→id{R∙val=id∙val}R \to \mathit{id} \qquad \{R_{\bullet val} = \mathit{id}_{\bullet val}\}




      Here #\# and %\% are operators and id\mathit{id} is a token that represents an integer and id∙val\mathit{id}_{\bullet 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 S∙valS_{\bullet val} for root of the parse tree for the expression 20#10%5#8%2%220 \# 10 \% 5 \# 8 \% 2 \% 2 is _____________.

    34. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

      (c) Semantic analyzer

    35. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following statements.

      S1S_1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree.
      S2S_2: The sequence of procedure returns corresponds to a postorder traversal of the activation tree.

      Which one of the following options is correct?

      1. (a) S1S_1 is true and S2S_2 is false
      2. (b) S1S_1 is false and S2S_2 is true
      3. (c) S1S_1 is true and S2S_2 is true
      4. (d) S1S_1 is false and S2S_2 is false
      Show answer

      (c) S1S_1 is true and S2S_2 is true

    36. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following statements.

      S1S_1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
      S2S_2: For any context-free grammar, there is a parser that takes at most O(n3)O(n^3) time to parse a string of length nn.

      Which one of the following options is correct?

      1. (a) S1S_1 is true and S2S_2 is false
      2. (b) S1S_1 is false and S2S_2 is true
      3. (c) S1S_1 is true and S2S_2 is true
      4. (d) S1S_1 is false and S2S_2 is false
      Show answer

      (c) S1S_1 is true and S2S_2 is true

    37. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

      (d) Symbol table

    38. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:

      P→D∗ E∗P \rightarrow D^*\ E^*
      D→D \rightarrow `int ID` {record that ID.lexeme is of type `int`}
      D→D \rightarrow `bool ID` {record that ID.lexeme is of type `bool`}
      E→E1+E2E \rightarrow E_1 + E_2 {check that E1E_1.type =E2= E_2.type == `int`; set EE.type := `int`}
      E→ !E1E \rightarrow\ !E_1 {check that E1E_1.type == `bool`; set EE.type := `bool`}
      E→E \rightarrow `ID` {set EE.type := `int`}

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

      1. (a) The actions can be used to correctly type-check any syntactically correct program.
      2. (b) The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.
      3. (c) The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions.
      4. (d) The actions will lead to an infinite loop.
      Show answer

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

    39. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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 f1 and f2, 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 dereference operations (of the form y->f1 or y->f2 ) 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
      Show answer

      (d) 303 and 2

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

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



      S→d a T∣R fT→a S∣b a T∣ϵR→c a T R∣ϵ\begin{aligned} S &\rightarrow d\,a\,T \mid R\,f \\ T &\rightarrow a\,S \mid b\,a\,T \mid \epsilon \\ R &\rightarrow c\,a\,T\,R \mid \epsilon \end{aligned}




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

      | | aa | bb | cc | dd | ff | \$ |
      |---|---|---|---|---|---|---|
      | S | | | ① | S→d a TS \rightarrow d\,a\,T | ② | |
      | T | T→a ST \rightarrow a\,S | T→b a TT \rightarrow b\,a\,T | ③ | | T→ϵT \rightarrow \epsilon | ④ |
      | R | | | R→c a T RR \rightarrow c\,a\,T\,R | | R→ϵR \rightarrow \epsilon | |

      Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?

      1. (a) ① S→R fS \rightarrow R\,f ② S→R fS \rightarrow R\,f ③ T→ϵT \rightarrow \epsilon ④ T→ϵT \rightarrow \epsilon
      2. (b) ① blank ② S→R fS \rightarrow R\,f ③ T→ϵT \rightarrow \epsilon ④ T→ϵT \rightarrow \epsilon
      3. (c) ① S→R fS \rightarrow R\,f ② blank ③ blank ④ T→ϵT \rightarrow \epsilon
      4. (d) ① blank ② S→R fS \rightarrow R\,f ③ blank ④ blank
      Show answer

      (a) ① S→R fS \rightarrow R\,f ② S→R fS \rightarrow R\,f ③ T→ϵT \rightarrow \epsilon ④ T→ϵT \rightarrow \epsilon

    41. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

      USE(S)\mathit{USE}(S) : the set of variables used in SS
      IN(S)\mathit{IN}(S) : the set of variables that are live at the entry of SS
      OUT(S)\mathit{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) OUT(S1)=IN(S2)\mathit{OUT}(S_1) = \mathit{IN}(S_2)
      2. (b) OUT(S1)=IN(S1)∪USE(S1)\mathit{OUT}(S_1) = \mathit{IN}(S_1) \cup \mathit{USE}(S_1)
      3. (c) OUT(S1)=IN(S2)∪OUT(S2)\mathit{OUT}(S_1) = \mathit{IN}(S_2) \cup \mathit{OUT}(S_2)
      4. (d) OUT(S1)=USE(S1)∪IN(S2)\mathit{OUT}(S_1) = \mathit{USE}(S_1) \cup \mathit{IN}(S_2)
      Show answer

      (a) OUT(S1)=IN(S2)\mathit{OUT}(S_1) = \mathit{IN}(S_2)

    42. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following C code segment: ```c a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f; ``` In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes in the DAG is ______.

    43. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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



      S′→SS' \to S





      S→S # cSS \to S \,\#\, c S





      S→SSS \to S S





      S→S @S \to S\,@





      S→ <S>S \to \,<S>





      S→aS \to a





      S→bS \to b





      S→cS \to c




      Let I0=CLOSURE({S′→∙S})I_0 = \mathrm{CLOSURE}(\{S' \to \bullet S\}). The number of items in the set GOTO(GOTO(I0,<),<)\mathrm{GOTO}(\mathrm{GOTO}(I_0, <), <) is __________.

    44. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following statements. I. Symbol table is accessed only during lexical analysis and syntax analysis. II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment. III. Errors violating the condition *'any variable must be declared before its use'* are detected during syntax analysis. Which of the above statements is/are TRUE?

      1. (a) I only
      2. (b) I and III only
      3. (c) II only
      4. (d) None of I, II, and III
      Show answer

      (d) None of I, II, and III

    45. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following grammar.



      S→aSB∣dS \to aSB \mid d





      B→bB \to b




      The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbbaaadbbb is \_\_\_\_\_\_\_.

    46. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the productions A →\to PQ and A →\to XY. Each of the five non-terminals A, P, Q, X, and Y has two attributes: ss is a synthesized attribute, and ii is an inherited attribute. Consider the following rules.

      Rule 1: P.ii = A.ii + 2, Q.ii = P.ii + A.ii, and A.ss = P.ss + Q.ss

      Rule 2: X.ii = A.ii + Y.ss and Y.ii = X.ss + A.ii

      Which one of the following is TRUE?

      1. (a) Both Rule 1 and Rule 2 are L-attributed.
      2. (b) Only Rule 1 is L-attributed.
      3. (c) Only Rule 2 is L-attributed.
      4. (d) Neither Rule 1 nor Rule 2 is L-attributed.
      Show answer

      (b) Only Rule 1 is L-attributed.

    47. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following kinds of derivation is used by LR parsers?

      1. (a) Leftmost
      2. (b) Leftmost in reverse
      3. (c) Rightmost
      4. (d) Rightmost in reverse
      Show answer

      (d) Rightmost in reverse

    48. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the grammar given below:

      S→AaS \to Aa

      A→BDA \to BD

      B→b∣ϵB \to b \mid \epsilon

      D→d∣ϵD \to d \mid \epsilon

      Let a, b, d, and \$ be indexed as follows:

      | a | b | d | \$ |
      |---|---|---|---|
      | 3 | 2 | 1 | 0 |

      Compute the FOLLOW set of the non-terminal B and write the index values for the symbols in the FOLLOW set in the descending order. (For example, if the FOLLOW set is {a, b, d, \$}, then the answer should be 3210)

      Answer: ________.

    49. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let X1X_1, X2X_2, X3X_3, X4X_4, X5X_5, and X6X_6 be the placeholders for the non-terminals D, T, L or L1L_1 in the following table:

      | Production rule | Semantic action |
      |---|---|
      | D→T LD \to T\ L | X1X_1.type = X2X_2.type |
      | T→intT \to \mathit{int} | T.type = int |
      | T→floatT \to \mathit{float} | T.type = float |
      | L→L1 , idL \to L_1\ ,\ \mathit{id} | X3X_3.type = X4X_4.type <br> addType(id.entry, X5X_5.type) |
      | L→idL \to \mathit{id} | addType(id.entry, X6X_6.type) |

      Which one of the following are the appropriate choices for X1X_1, X2X_2, X3X_3 and X4X_4?

      1. (a) X1=LX_1 = L, X2=TX_2 = T, X3=L1X_3 = L_1, X4=LX_4 = L
      2. (b) X1=TX_1 = T, X2=LX_2 = L, X3=L1X_3 = L_1, X4=TX_4 = T
      3. (c) X1=LX_1 = L, X2=LX_2 = L, X3=L1X_3 = L_1, X4=TX_4 = T
      4. (d) X1=TX_1 = T, X2=LX_2 = L, X3=TX_3 = T, X4=L1X_4 = L_1
      Show answer

      (a) X1=LX_1 = L, X2=TX_2 = T, X3=L1X_3 = L_1, X4=LX_4 = L

    50. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the augmented grammar given below:

      S′→SS' \to S

      S→⟨L⟩∣idS \to \langle L\rangle \mid \mathit{id}

      L→L,S∣SL \to L,S \mid S

      Let I0=CLOSURE({[S′→∙S]})I_0 = \mathrm{CLOSURE}(\{[S' \to \bullet S]\}). The number of items in the set GOTO(I0,⟨)\mathrm{GOTO}(I_0, \langle) is: ________.

  9. 12Operating systems6 ch · 1 h 28 min65 PYQ
    1. System calls, processes and threads 13′
    2. CPU scheduling 14′
    3. Synchronisation and inter-process communication 14′
    4. Deadlock 14′
    5. Memory management and virtual memory 17′
    6. File systems and disk scheduling 16′
    See the 65 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      1. (a) Shortest Remaining Time First (SRTF) Scheduling
      2. (b) First Come First Serve (FCFS) Scheduling
      3. (c) Round Robin Scheduling
      4. (d) Priority Scheduling
      Show answer

      (b) First Come First Serve (FCFS) Scheduling

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      With respect to deadlocks in an operating system, which of the following statements is/are FALSE?

      1. (a) Banker’s algorithm is used to prevent deadlocks
      2. (b) Deadlock formation can be prevented by ensuring that the hold and wait condition is not allowed
      3. (c) An assignment edge in a resource allocation graph is marked from a process to a resource
      4. (d) A safe state guarantees that all processes can finish without formation of a deadlock
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider a system consisting of kk instances of a resource RR, being shared by 5 processes. Assume that each process requires a maximum of two instances of resource RR and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance.

      The minimum value of kk for the system to be deadlock-free is ________. (*answer in integer*)

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) **$*###
      2. (b) **$#*##
      3. (c) **$##*#
      4. (d) ***$###
      Show answer

      ()

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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=2101\text{K} = 2^{10} and 1G=2301\text{G} = 2^{30}

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a system that has a cache memory unit and a memory management unit (MMU). The address input to the cache memory is a physical address. The MMU has a translation lookaside buffer (TLB). Assume that when a page is evicted from the main memory, the corresponding blocks in the cache are marked as invalid. For a given memory reference, which of the following sequences of events can NEVER happen?

      1. (a) TLB miss, Page table hit, Cache hit
      2. (b) TLB hit, Page table miss, Cache hit
      3. (c) TLB miss, Page table miss, Cache hit
      4. (d) TLB miss, Page table miss, Cache miss
      Show answer

      ()

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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=2101\text{K} = 2^{10}, 1M=2201\text{M} = 2^{20}, 1G=2301\text{G} = 2^{30}

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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=2101\text{K} = 2^{10}

    9. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a hard disk with a rotational speed of 15000 rpm. The time to move the read/write head from a track to its adjacent track is 1 millisecond. Initially, the head is on track 0. The number of sectors per track is 400. The sector size is 1024 bytes. It is necessary to transfer data from 10 randomly located sectors in each of the following tracks in the order: 5, 12 and 7. The total time for the data transfer (in milliseconds) from the hard disk is _________. (*rounded off to one decimal place*)

    10. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the `fork()` system call is always successful in creating a process. ```c int main () { int i; for (i = 0; i < 3; i++){ if (fork() == 0){ continue; } break; } printf("Hello!"); return 0; } ``` The total number of times that the `printf` statement gets executed is ________. (*answer in integer*)

    11. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst of 8 seconds. A new process of type A arrives at time tt = 10, 20, 30, 40, and 50 (in seconds). Similarly, a new process of type C arrives at time tt = 11, 22, 33, 44, and 55 (in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at t=10t = 10 seconds. The average waiting time (in seconds) for the 10 processes is ___________. (*rounded off to one decimal place*)

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider a demand paging memory management system with 32-bit logical address, 20-bit physical address, and page size of 2048 bytes. Assuming that the memory is byte addressable, what is the maximum number of entries in the page table?

      1. (a) 2212^{21}
      2. (b) 2202^{20}
      3. (c) 2222^{22}
      4. (d) 2242^{24}
      Show answer

      (a) 2212^{21}

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Processes P1P1, P2P2, P3P3, P4P4 arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.

      Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?

      1. (a) 22
      2. (b) 15
      3. (c) 37
      4. (d) 19
      Show answer

      (d) 19

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _______. (Answer in integer) ``` int main() { int x=0,i=0; scanf("%d",&x); for(i=0; i<20; i++) { x = x+20; printf("%d\n",x); } return 0; } ```

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A computer has two processors, M1M_1 and M2M_2. Four processes P1,P2,P3,P4P_1, P_2, P_3, P_4 with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:

      - M1M_1 uses priority of execution for the processes as, P1>P3>P2>P4P_1 > P_3 > P_2 > P_4, i.e., P1P_1 and P4P_4 have highest and lowest priorities, respectively.
      - M2M_2 uses priority of execution for the processes as, P2>P3>P4>P1P_2 > P_3 > P_4 > P_1, i.e., P2P_2 and P1P_1 have highest and lowest priorities, respectively.

      A process PiP_i is scheduled to a processor MkM_k, if the processor is free and no other process PjP_j is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?

      1. (a) 9.00
      2. (b) 8.75
      3. (c) 6.50
      4. (d) 7.50
      Show answer

      (a) 9.00

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2. The contents of the frames are as follows initially and after each reference (from left to right): | *initially* | *after* | | | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---|---|---|---|---| | - | 1* | 2* | 3* | 4* | 5* | 4 | 1 | 6* | 4 | 5 | 1* | 3* | 2* | | - | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | 6 | 6 | 6 | 6 | 2 | | - | - | 2 | 2 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 1 | 1 | 1 | | - | - | - | 3 | 3 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 3 | 3 | The *-marked references cause page replacements. Which one or more of the following could be the page replacement policy/policies in use?

      1. (a) Least Recently Used page replacement policy
      2. (b) Least Frequently Used page replacement policy
      3. (c) Most Frequently Used page replacement policy
      4. (d) Optimal page replacement policy
      Show answer

      (d) Optimal page replacement policy

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      P={P1,P2,P3,P4}P = \{P_1, P_2, P_3, P_4\} consists of all active processes in an operating system. R={R1,R2,R3,R4}R = \{R_1, R_2, R_3, R_4\} consists of single instances of distinct types of resources in the system.

      The resource allocation graph has the following assignment and claim edges.

      Assignment edges: R1→P1R_1 \rightarrow P_1, R2→P2R_2 \rightarrow P_2, R3→P3R_3 \rightarrow P_3, R4→P4R_4 \rightarrow P_4 (the assignment edge R1→P1R_1 \rightarrow P_1 means resource R1R_1 is assigned to process P1P_1, and so on for others)

      Claim edges: P1→R2P_1 \rightarrow R_2, P2→R3P_2 \rightarrow R_3, P3→R1P_3 \rightarrow R_1, P2→R4P_2 \rightarrow R_4, P4→R2P_4 \rightarrow R_2 (the claim edge P1→R2P_1 \rightarrow R_2 means process P1P_1 is waiting for resource R2R_2, and so on for others)

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

      1. (a) Aborting P1P_1 makes the system deadlock free.
      2. (b) Aborting P3P_3 makes the system deadlock free.
      3. (c) Aborting P2P_2 makes the system deadlock free.
      4. (d) Aborting P1P_1 and P4P_4 makes the system deadlock free.
      Show answer

      ()

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1M bytes needs to be stored in the disk. Assume, 1K=2101\text{K} = 2^{10} and 1M=2201\text{M} = 2^{20}. The amount of space in bytes that will be wasted due to internal fragmentation is ______. (Answer in integer)

    19. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal page replacement algorithm is as follows: The OS correctly predicts only up to next 4 page references (including the current page) at the time of allocating a frame to a page. A process accesses the pages in the following order of page numbers: 1, 3, 2, 4, 2, 3, 1, 2, 4, 3, 1, 4. If the system has three memory frames that are initially empty, the number of page faults that will occur during execution of the process is ________ . (Answer in integer)

    20. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A computer system supports a logical address space of 2322^{32} bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a bb-bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.

      The value of bb is ___________ . (Answer in integer)

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following statements about threads is/are TRUE?

      1. (a) Threads can only be implemented in kernel space
      2. (b) Each thread has its own file descriptor table for open files
      3. (c) All the threads belonging to a process share a common stack
      4. (d) Threads belonging to a process are by default not protected from each other
      Show answer

      (d) Threads belonging to a process are by default not protected from each other

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?

      1. (a) Allocate a new page table for a newly created process
      2. (b) Translate a virtual address to a physical address using the page table
      3. (c) Raise a trap when a virtual address is not found in the page table
      4. (d) Raise a trap when a process tries to write to a page marked with read-only permission in the page table
      Show answer

      ()

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following process state transitions is/are NOT possible?

      1. (a) Running to Ready
      2. (b) Waiting to Running
      3. (c) Ready to Waiting
      4. (d) Running to Terminated
      Show answer

      ()

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)?

      1. (a) P makes a blocking system call to read a block of data from the disk
      2. (b) P tries to access a page that is in the swap space, triggering a page fault
      3. (c) An interrupt is raised by the disk to deliver data requested by some other process
      4. (d) A timer interrupt is raised by the hardware
      Show answer

      ()

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time. A (0, 10), B (2, 6), C (4, 3), and D (6, 7). Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?

      1. (a) SRTF = 6, NP-SJF = 7
      2. (b) SRTF = 6, NP-SJF = 7.5
      3. (c) SRTF = 7, NP-SJF = 7.5
      4. (d) SRTF = 7, NP-SJF = 8.5
      Show answer

      (b) SRTF = 6, NP-SJF = 7.5

    26. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially a = b = 1. Though context switching between threads can happen at any time, each statement of T1 or T2 is executed atomically without interruption. | T1 | T2 | |---|---| | `a = a + 1;` | `b = 2 * b;` | | `b = b + 1;` | `a = 2 * a;` | Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?

      1. (a) (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3)
      2. (b) (a = 3, b = 4); (a = 4, b = 3); (a = 3, b = 3)
      3. (c) (a = 4, b = 4); (a = 4, b = 3); (a = 3, b = 4)
      4. (d) (a = 2, b = 2); (a = 2, b = 3); (a = 3, b = 4)
      Show answer

      (a) (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3)

    27. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a multi-threaded program with two threads T1 and T2. The threads share two semaphores: s1 (initialized to 1) and s2 (initialized to 0). The threads also share a global variable x (initialized to 0). The threads execute the code shown below. ``` // code of T1 // code of T2 wait(s1); wait(s1); x = x+1; x = x+1; print(x); print(x); wait(s2); signal(s2); signal(s1); signal(s1); ``` Which of the following outcomes is/are possible when threads T1 and T2 execute concurrently?

      1. (a) T1 runs first and prints 1, T2 runs next and prints 2
      2. (b) T2 runs first and prints 1, T1 runs next and prints 2
      3. (c) T1 runs first and prints 1, T2 does not print anything (deadlock)
      4. (d) T2 runs first and prints 1, T1 does not print anything (deadlock)
      Show answer

      ()

    28. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a disk with the following specifications: rotation speed of 6000 RPM, average seek time of 5 milliseconds, 500 sectors/track, 512-byte sectors. A file has content stored in 3000 sectors located *randomly* on the disk. Assuming average rotational latency, the total time (*in seconds, rounded off to 2 decimal places*) to read the entire file from the disk is _________

    29. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a 512 GB hard disk with 32 storage surfaces. There are 4096 sectors per track and each sector holds 1024 bytes of data. The number of cylinders in the hard disk is _________

    30. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system calls run successfully without any errors. ``` int x = 3; while(x > 0) { fork(); printf("hello"); wait(NULL); x--; } ``` The total number of times the printf statement is executed is _______

    31. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a memory management system that uses a page size of 2 KB. Assume that both the physical and virtual addresses start from 0. Assume that the pages 0, 1, 2, and 3 are stored in the page frames 1, 3, 2, and 0, respectively. The physical address (*in decimal format*) corresponding to the virtual address 2500 (*in decimal format*) is _________

    32. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a 32-bit system with 4 KB page size and page table entries of size 4 bytes each. Assume 1 KB = 2102^{10} bytes. The OS uses a 2-level page table for memory management, with the page table containing an outer page directory and an inner page table. The OS allocates a page for the outer page directory upon process creation. The OS uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.

      An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let X denote the minimum and Y denote the maximum number of pages across the two levels of the page table of the process.

      The value of X+Y is ________

    33. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one or more of the following need to be saved on a context switch from one thread (T1) of a process to another thread (T2) of the same process?

      1. (a) Page table base register
      2. (b) Stack pointer
      3. (c) Program counter
      4. (d) General purpose registers
      Show answer

      ()

    34. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?

      1. (a) Function Call
      2. (b) malloc Call
      3. (c) Page Fault
      4. (d) System Call
      Show answer

      ()

    35. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one or more of the following CPU scheduling algorithms can potentially cause starvation?

      1. (a) First-in First-Out
      2. (b) Round Robin
      3. (c) Priority Scheduling
      4. (d) Shortest Job First
      Show answer

      ()

    36. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the two functions incr and decr shown below. ``` incr(){ decr(){ wait(s); wait(s); X = X+1; X = X-1; signal(s); signal(s); } } ``` There are 5 threads each invoking incr once, and 3 threads each invoking decr once, on the same shared variable X. The initial value of X is 10. Suppose there are two implementations of the semaphore s, as follows: I-1: s is a binary semaphore initialized to 1. I-2: s is a counting semaphore initialized to 2. Let V1, V2 be the values of X at the end of execution of all the threads with implementations I-1, I-2, respectively. Which one of the following choices corresponds to the minimum possible values of V1, V2, respectively?

      1. (a) 15, 7
      2. (b) 7, 7
      3. (c) 12, 7
      4. (d) 12, 8
      Show answer

      (c) 12, 7

    37. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following two-dimensional array D in the C programming language, which is stored in row-major order: ```c int D[128][128]; ``` Demand paging is used for allocating memory and each physical page frame holds 512 elements of the array D. The Least Recently Used (LRU) page-replacement policy is used by the operating system. A total of 30 physical page frames are allocated to a process which executes the following code snippet: ```c for (int i = 0; i < 128; i++) for (int j = 0; j < 128; j++) D[j][i] *= 10; ``` The number of page faults generated during the execution of this code snippet is ____________.

    38. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a computer system with 57-bit virtual addressing using multi-level tree-structured page tables with LL levels for virtual to physical address translation. The page size is 4 KB (1 KB = 1024 B) and a page table entry at any of the levels occupies 8 bytes.

      The value of LL is ____________.

    39. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following threads, T1T_1, T2T_2, and T3T_3 executing on a single processor, synchronized using three binary semaphore variables, S1S_1, S2S_2, and S3S_3, operated upon using standard `wait()` and `signal()`. The threads can be context switched in any order and at any time.

      | T1T_1 | T2T_2 | T3T_3 |
      |---|---|---|
      | `while(true){` | `while(true){` | `while(true){` |
      | `wait(S3);` | `wait(S1);` | `wait(S2);` |
      | `print(“C”);` | `print(“B”);` | `print(“A”);` |
      | `signal(S2); }` | `signal(S3); }` | `signal(S1); }` |

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

      1. (a) S1=1S_1 = 1; S2=1S_2 = 1; S3=1S_3 = 1
      2. (b) S1=1S_1 = 1; S2=1S_2 = 1; S3=0S_3 = 0
      3. (c) S1=1S_1 = 1; S2=0S_2 = 0; S3=0S_3 = 0
      4. (d) S1=0S_1 = 0; S2=1S_2 = 1; S3=1S_3 = 1
      Show answer

      (c) S1=1S_1 = 1; S2=0S_2 = 0; S3=0S_3 = 0

    40. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      1. (a) Circular wait is a necessary condition for the formation of deadlock.
      2. (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.
      3. (c) If the current allocation of resources to processes leads the system to unsafe state, then deadlock will necessarily occur.
      4. (d) In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.
      Show answer

      ()

    41. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which one of the following statements is FALSE?

      1. (a) The TLB performs an associative search in parallel on all its valid entries using page number of incoming virtual address.
      2. (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.
      3. (c) The memory access time using a given inverted page table is always same for all incoming virtual addresses.
      4. (d) In a system that uses hashed page tables, if two distinct virtual addresses V1 and V2 map to the same value while hashing, then the memory access time of these addresses will not be the same.
      Show answer

      (c) The memory access time using a given inverted page table is always same for all incoming virtual addresses.

    42. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. 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?

      1. (a) P = 4, Q = 10, R = 6, S = 2
      2. (b) P = 2, Q = 9, R = 5, S = 1
      3. (c) P = 4, Q = 12, R = 5, S = 4
      4. (d) P = 3, Q = 7, R = 7, S = 3
      Show answer

      (d) P = 3, Q = 7, R = 7, S = 3

    43. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider two files 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 are nAn_A and nBn_B, respectively, then the value of nA+nBn_A + n_B is_________.

    44. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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_________.

    45. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

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

      1. (a) Paging helps solve the issue of external fragmentation.
      2. (b) Page size has no impact on internal fragmentation.
      3. (c) Paging incurs memory overheads.
      4. (d) Multi-level paging is necessary to support pages of different sizes.
      Show answer

      ()

    46. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following standard C library functions will *always* invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?

      1. (a) `exit`
      2. (b) `malloc`
      3. (c) `sleep`
      4. (d) `strlen`
      Show answer

      ()

    47. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

      ()

    48. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory `foo`. Which of the following operations will necessarily require a full scan of `foo` for successful completion?

      1. (a) Creation of a new file in `foo`
      2. (b) Deletion of an existing file from `foo`
      3. (c) Renaming of an existing file in `foo`
      4. (d) Opening of an existing file in `foo`
      Show answer

      ()

    49. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is ______ milliseconds.

    50. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

      ()

    51. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

      ()

    52. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following pseudocode, where `S` is a semaphore initialized to 5 in line#2 and `counter` is a shared variable initialized to 0 in line#1. Assume that the increment operation in line#7 is *not* atomic. ``` 1. int counter = 0; 2. Semaphore S = init(5); 3. void parop(void) 4. { 5. wait(S); 6. wait(S); 7. counter++; 8. signal(S); 9. signal(S); 10.} ``` If five threads execute the function `parop` concurrently, which of the following program behavior(s) is/are possible?

      1. (a) The value of `counter` is 5 after all the threads successfully complete the execution of `parop`.
      2. (b) The value of `counter` is 1 after all the threads successfully complete the execution of `parop`.
      3. (c) The value of `counter` is 0 after all the threads successfully complete the execution of `parop`.
      4. (d) There is a deadlock involving all the threads.
      Show answer

      ()

    53. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

      | Level 1 offset | Level 2 offset | Level 3 offset | Page offset |
      |---|---|---|---|
      | 9 bits | 9 bits | 9 bits | 12 bits |

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

    54. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process's memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?

      1. (a) The hole created by first fit is always larger than the hole created by next fit.
      2. (b) The hole created by worst fit is always larger than the hole created by first fit.
      3. (c) The hole created by best fit is never larger than the hole created by first fit.
      4. (d) The hole created by next fit is never larger than the hole created by best fit.
      Show answer

      (c) The hole created by best fit is never larger than the hole created by first fit.

    55. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following statements about process state transitions for a system using preemptive scheduling. I. A running process can move to ready state. II. A ready process can move to running state. III. A blocked process can move to running state. IV. A blocked process can move to ready state. Which of the above statements are TRUE?

      1. (a) I, II, and III only
      2. (b) II and III only
      3. (c) I, II, and IV only
      4. (d) I, II, III, and IV
      Show answer

      (c) I, II, and IV only

    56. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Each of a set of nn processes executes the following code using two semaphores `a` and `b` initialized to 1 and 0, respectively. Assume that `count` is a shared variable initialized to 0 and not used in CODE SECTION P.

      ```
      CODE SECTION P

      wait(a); count=count+1;
      if (count==n) signal(b);
      signal(a); wait(b); signal(b);

      CODE SECTION Q
      ```

      What does the code achieve?

      1. (a) It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.
      2. (b) It ensures that at most two processes are in CODE SECTION Q at any time.
      3. (c) It ensures that all processes execute CODE SECTION P mutually exclusively.
      4. (d) It ensures that at most n−1n-1 processes are in CODE SECTION P at any time.
      Show answer

      (a) It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.

    57. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time. (P, 155), (Q, 85), (R, 110), (S, 30), (T, 115) Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests. Which one of the following statements is FALSE?

      1. (a) T is serviced before P.
      2. (b) Q is serviced after S, but before T.
      3. (c) The head reverses its direction of movement between servicing of Q and P.
      4. (d) R is serviced before P.
      Show answer

      (b) Q is serviced after S, but before T.

    58. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1,P2,P3,P4P_1, P_2, P_3, P_4.

      | Processes | P1P_1 | P2P_2 | P3P_3 | P4P_4 |
      |---|---|---|---|---|
      | Burst time (in ms) | 8 | 7 | 2 | 4 |

      If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is \_\_\_\_\_\_\_\_.

    59. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a paging system that uses 1-level page table residing in main memory and a TLB for address translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume that for 20% of the total page faults, a dirty page has to be written back to disk before the required page is read in from disk. TLB update time is negligible. The average memory access time in ns (round off to 1 decimal places) is \_\_\_\_\_\_.

    60. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The following C program is executed on a Unix/Linux system: ```c #include <unistd.h> int main() { int i; for (i=0; i<10; i++) if (i%2 == 0) fork(); return 0; } ``` The total number of child processes created is ________.

    61. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100. | P1 | P2 | P3 | |---|---|---| | : | : | : | | : | : | : | | D = D + 20 | D = D – 50 | D = D + 10 | | : | : | : | | : | : | : | The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three processes have completed execution are X and Y respectively, then the value of Y – X is ____________.

    62. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Assume that in a certain computer, the virtual addresses are 64 bits long and the physical addresses are 48 bits long. The memory is word addressible. The page size is 8 kB and the word size is 4 bytes. The Translation Look-aside Buffer (TLB) in the address translation path has 128 valid entries. At most how many distinct virtual addresses can be translated without any TLB miss?

      1. (a) 16×21016 \times 2^{10}
      2. (b) 256×210256 \times 2^{10}
      3. (c) 4×2204 \times 2^{20}
      4. (d) 8×2208 \times 2^{20}
      Show answer

      (b) 256×210256 \times 2^{10}

    63. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following snapshot of a system running nn concurrent processes. Process ii is holding XiX_i instances of a resource R, 1≤i≤n1 \le i \le n. Assume that all instances of R are currently in use. Further, for all ii, process ii can place a request for at most YiY_i additional instances of R while holding the XiX_i instances it already has. Of the nn processes, there are exactly two processes pp and qq such that Yp=Yq=0Y_p = Y_q = 0. Which one of the following conditions guarantees that no other process apart from pp and qq can complete execution?

      1. (a) Xp+Xq<Min {Yk∣1≤k≤n,k≠p,k≠q}X_p + X_q < \mathrm{Min}\,\{Y_k \mid 1 \le k \le n, k \ne p, k \ne q\}
      2. (b) Xp+Xq<Max {Yk∣1≤k≤n,k≠p,k≠q}X_p + X_q < \mathrm{Max}\,\{Y_k \mid 1 \le k \le n, k \ne p, k \ne q\}
      3. (c) Min (Xp,Xq)≥Min {Yk∣1≤k≤n,k≠p,k≠q}\mathrm{Min}\,(X_p, X_q) \ge \mathrm{Min}\,\{Y_k \mid 1 \le k \le n, k \ne p, k \ne q\}
      4. (d) Min (Xp,Xq)≤Max {Yk∣1≤k≤n,k≠p,k≠q}\mathrm{Min}\,(X_p, X_q) \le \mathrm{Max}\,\{Y_k \mid 1 \le k \le n, k \ne p, k \ne q\}
      Show answer

      (a) Xp+Xq<Min {Yk∣1≤k≤n,k≠p,k≠q}X_p + X_q < \mathrm{Min}\,\{Y_k \mid 1 \le k \le n, k \ne p, k \ne q\}

    64. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following four processes with arrival times (in milliseconds) and their length of CPU bursts (in milliseconds) as shown below: | Process | P1 | P2 | P3 | P4 | |---|---|---|---|---| | Arrival time | 0 | 1 | 3 | 4 | | CPU burst time | 3 | 1 | 3 | Z | These processes are run on a single processor using preemptive Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is 1 millisecond, then the value of Z is________.

    65. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The index node (inode) of a Unix-like file system has 12 direct, one single-indirect and one double-indirect pointers. The disk block size is 4 kB, and the disk block address is 32-bits long. The maximum possible file size is (rounded off to 1 decimal place) _________ GB.

  10. 13Databases5 ch · 1 h 16 min58 PYQ
    1. ER model and relational model 15′
    2. Relational algebra, tuple calculus and SQL 15′
    3. Integrity constraints and normal forms 15′
    4. File organisation and indexing 15′
    5. Transactions and concurrency control 16′
    See the 58 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      In the context of DBMS, consider the two sets T and S given below. | T | S | |---|---| | I: Logical schema | L: Views | | II: Physical schema | M: File organization and indexes | | III: External schema | N: Relations | Which one of the following is the correct match from T to S ?

      1. (a) I – L, II – M, III – N
      2. (b) I – M, II – L, III – N
      3. (c) I – N, II – M, III – L
      4. (d) I – N, II – L, III – M
      Show answer

      (c) I – N, II – M, III – L

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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?

      1. (a) Both T1T_1 and T2T_2 only read AA
      2. (b) T1T_1 reads AA and T2T_2 writes AA
      3. (c) T1T_1 writes AA and T2T_2 reads AA
      4. (d) Both T1T_1 and T2T_2 write AA
      Show answer

      (a) Both T1T_1 and T2T_2 only read AA

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Let PP, QQ, RR and SS be the attributes of a relation in a relational schema. Let X→YX \to Y indicate functional dependency in the context of a relational database, where X,Y⊆{P,Q,R,S}X, Y \subseteq \{P, Q, R, S\}.

      Which of the following options is/are always true?

      1. (a) If ( {P,Q}→{R}\{P, Q\} \to \{R\} and {P}→{R}\{P\} \to \{R\} ), then {Q}→{R}\{Q\} \to \{R\}
      2. (b) If {P,Q}→{R}\{P, Q\} \to \{R\}, then ( {P}→{R}\{P\} \to \{R\} or {Q}→{R}\{Q\} \to \{R\} )
      3. (c) If ( {P}→{R}\{P\} \to \{R\} and {Q}→{S}\{Q\} \to \{S\} ), then {P,Q}→{R,S}\{P, Q\} \to \{R, S\}
      4. (d) If {P}→{R}\{P\} \to \{R\}, then {P,Q}→{R}\{P, Q\} \to \{R\}
      Show answer

      ()

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      In the context of relational database normalization, which of the following statements is/are true?

      1. (a) It is always possible to obtain a dependency-preserving 3NF decomposition of a relation
      2. (b) It is always possible to obtain a dependency-preserving 1NF decomposition of a relation
      3. (c) It is not always possible to obtain a dependency-preserving BCNF decomposition of a relation
      4. (d) It is not always possible to obtain a dependency-preserving 2NF decomposition of a relation
      Show answer

      ()

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

      In the context of schema normalization in relational DBMS, consider a set F of functional dependencies. The set of all functional dependencies implied by F is called the closure of F. To compute the closure of F, 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 \to Y

      Augmentation: If X→YX \to Y, then XZ→YZXZ \to YZ for any Z

      Transitivity: If X→YX \to Y and Y→ZY \to Z, then X→ZX \to Z

      The additional rule of Union is defined as follows.

      Union: If X→YX \to Y and X→ZX \to Z, then X→YZX \to 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 ?

      1. (a) Reflexivity, Augmentation, and Transitivity
      2. (b) Reflexivity and Augmentation
      3. (c) Transitivity
      4. (d) Augmentation and Transitivity
      Show answer

      (d) Augmentation and Transitivity

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a relational database schema with two relations R(P,Q)R(P, Q) and S(X,Y)S(X, Y).

      Let E={⟨u⟩∣∃v ∃w ⟨u,v⟩∈R∧⟨v,w⟩∈S}E = \{\langle u \rangle \mid \exists v\, \exists w\ \langle u, v \rangle \in R \wedge \langle v, w \rangle \in S\} be a tuple relational calculus expression.

      Which one of the following relational algebraic expressions is equivalent to EE ?

      1. (a) ΠP(R⋈R.P=S.XS)\Pi_P(R \bowtie_{R.P = S.X} S)
      2. (b) ΠP(S⋈S.X=R.QR)\Pi_P(S \bowtie_{S.X = R.Q} R)
      3. (c) ΠP(R⋈R.P=S.YS)\Pi_P(R \bowtie_{R.P = S.Y} S)
      4. (d) ΠP(S⋈S.Y=R.QR)\Pi_P(S \bowtie_{S.Y = R.Q} R)
      Show answer

      (b) ΠP(S⋈S.X=R.QR)\Pi_P(S \bowtie_{S.X = R.Q} R)

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) Both S1 and S2 are true
      2. (b) Both S1 and S2 are false
      3. (c) S1 is true and S2 is false
      4. (d) S1 is false and S2 is true
      Show answer

      (a) Both S1 and S2 are true

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider a relational database schema with a relation R(A,B,C,D)R(A, B, C, D). If {A,B}\{A, B\} and {A,C}\{A, C\} are the only two candidate keys of the relation RR, then the number of superkeys of relation RR is ______. (*answer in integer*)

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A schedule of three database transactions T1T_1, T2T_2, and T3T_3 is shown. Ri(A)R_i(A) and Wi(A)W_i(A) denote read and write of data item AA by transaction TiT_i, i=1,2,3i = 1,2,3. The transaction T1T_1 aborts at the end. Which other transaction(s) will be required to be rolled back?



      R1(X) W1(Y) R2(X) R2(Y) R3(Y) ABORT(T1)R_1(X)\ W_1(Y)\ R_2(X)\ R_2(Y)\ R_3(Y)\ \mathit{ABORT}(T_1)


      1. (a) Only T2T_2
      2. (b) Only T3T_3
      3. (c) Both T2T_2 and T3T_3
      4. (d) Neither T2T_2 nor T3T_3
      Show answer

      (c) Both T2T_2 and T3T_3

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following B+B^+ tree with 5 nodes, in which a node can store at most 3 key values. The value 23 is now inserted in the B+B^+ tree. Which of the following options(s) is/are CORRECT?

      Root node: [6 | 12 | 19], with four children (leaf nodes), from left to right: [1 | 4 | 3], [7 | 9 | 10], [13 | 15 | 17], [20 | 21 | 22].

      1. (a) None of the nodes will split.
      2. (b) At least one node will split and redistribute.
      3. (c) The total number of nodes will remain same.
      4. (d) The height of the tree will increase.
      Show answer

      ()

    11. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      An audit of a banking transactions system has found that on an earlier occasion, two joint holders of account AA attempted simultaneous transfers of Rs. 10000 each from account AA to account BB. Both transactions read the same value, Rs. 11000, as the initial balance in AA and were allowed to go through. BB was credited Rs. 10000 twice. AA was debited only once and ended up with a balance of Rs. 1000.

      Which of the following properties is/are certain to have been violated by the system?

      1. (a) Atomicity
      2. (b) Consistency
      3. (c) Isolation
      4. (d) Durability
      Show answer

      ()

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider two relations describing teams\mathit{teams} and players\mathit{players} in a sports league:

      - teams(tid,tname)\mathit{teams}(\mathit{tid}, \mathit{tname}): tid\mathit{tid}, tname\mathit{tname} are team-id and team-name, respectively
      - players(pid,pname,tid)\mathit{players}(\mathit{pid}, \mathit{pname}, \mathit{tid}): pid\mathit{pid}, pname\mathit{pname}, and tid\mathit{tid} denote player-id, player-name and the team-id of the player, respectively

      Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having tname\mathit{tname} as 'MI'?

      1. (a) {p.pname∣p∈players∧∃t (t∈teams∧p.tid=t.tid∧t.tname=’MI’)}\{ p.\mathit{pname} \mid p \in \mathit{players} \land \exists t\,(t \in \mathit{teams} \land p.\mathit{tid} = t.\mathit{tid} \land t.\mathit{tname} = \text{'MI'})\}
      2. (b) {p.pname∣p∈teams∧∃t (t∈players∧p.tid=t.tid∧t.tname=’MI’)}\{ p.\mathit{pname} \mid p \in \mathit{teams} \land \exists t\,(t \in \mathit{players} \land p.\mathit{tid} = t.\mathit{tid} \land t.\mathit{tname} = \text{'MI'})\}
      3. (c) {p.pname∣p∈players∧∃t (t∈teams∧t.tname=’MI’)}\{ p.\mathit{pname} \mid p \in \mathit{players} \land \exists t\,(t \in \mathit{teams} \land t.\mathit{tname} = \text{'MI'})\}
      4. (d) {p.pname∣p∈teams∧∃t (t∈players∧t.tname=’MI’)}\{ p.\mathit{pname} \mid p \in \mathit{teams} \land \exists t\,(t \in \mathit{players} \land t.\mathit{tname} = \text{'MI'})\}
      Show answer

      (a) {p.pname∣p∈players∧∃t (t∈teams∧p.tid=t.tid∧t.tname=’MI’)}\{ p.\mathit{pname} \mid p \in \mathit{players} \land \exists t\,(t \in \mathit{teams} \land p.\mathit{tid} = t.\mathit{tid} \land t.\mathit{tname} = \text{'MI'})\}

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following relational schema along with all the functional dependencies that hold on them.

      R1(A, B, C, D, E): {D→E, EA→B, EB→C}\{D \rightarrow E,\ EA \rightarrow B,\ EB \rightarrow C\}

      R2(A, B, C, D): {A→D, A→B, C→A}\{A \rightarrow D,\ A \rightarrow B,\ C \rightarrow A\}

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

      1. (a) R1 is in 3NF
      2. (b) R2 is in 3NF
      3. (c) R1 is NOT in 3NF
      4. (d) R2 is NOT in 3NF
      Show answer

      ()

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a relational schema team(name,city,owner)\mathit{team}(\mathit{name}, \mathit{city}, \mathit{owner}), with functional dependencies {name→city,name→owner}\{\mathit{name} \to \mathit{city}, \mathit{name} \to \mathit{owner}\}.

      The relation team\mathit{team} is decomposed into two relations, t1(name,city)t1(\mathit{name}, \mathit{city}) and t2(name,owner)t2(\mathit{name}, \mathit{owner}). Which of the following statement(s) is/are TRUE?

      1. (a) The relation team\mathit{team} is NOT in BCNF.
      2. (b) The relations t1t1 and t2t2 are in BCNF.
      3. (c) The decomposition constitutes a lossless join.
      4. (d) The relation team\mathit{team} is NOT in 3NF.
      Show answer

      ()

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the database transactions T1 and T2, and data items X and Y. Which of the schedule(s) is/are conflict serializable? | Transaction T1 | Transaction T2 | |---|---| | R1(X) | W2(X) | | W1(Y) | W2(Y) | | R1(X) | COMMIT(T2) | | W1(X) | | | COMMIT(T1) | |

      1. (a) R1(X), W2(X), W1(Y), W2(Y), R1(X), W1(X), COMMIT(T2), COMMIT(T1)
      2. (b) W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
      3. (c) R1(X), W1(Y), W2(X), W2(Y), R1(X), W1(X), COMMIT(T1), COMMIT(T2)
      4. (d) W2(X), R1(X), W1(Y), W2(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
      Show answer

      (b) W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider the following relational schema: Students (rollno: integer, name: string, age: integer, cgpa: real) Courses (courseno: integer, cname: string, credits: integer) Enrolled (rollno: integer, courseno: integer, grade: string) Which of the following options is/are correct SQL query/queries to retrieve the names of the students enrolled in course number (i.e., courseno) 1470?

      1. (a) ```sql SELECT S.name FROM Students S WHERE EXISTS (SELECT * FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno); ```
      2. (b) ```sql SELECT S.name FROM Students S WHERE SIZEOF (SELECT * FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno) > 0; ```
      3. (c) ```sql SELECT S.name FROM Students S WHERE 0 < (SELECT COUNT(*) FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno); ```
      4. (d) ```sql SELECT S.name FROM Students S NATURAL JOIN Enrolled E WHERE E.courseno = 1470; ```
      Show answer

      ()

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following database tables of a sports league. ``` player(pid,pname,age) team(tid,tname,city,cid) coach(cid,cname) members(pid,tid) ``` An instance of the table and an SQL query are given. player | pid | pname | age | |---|---|---| | 1 | Jasprit | 31 | | 2 | Atharva | 24 | | 3 | Ishan | 26 | | 4 | Axar | 30 | coach | cid | cname | |---|---| | 101 | Ricky | | 102 | Mark | | 103 | Trevor | team | tid | tname | city | cid | |---|---|---|---| | 10 | MI | Mumbai | 102 | | 20 | DC | Delhi | 101 | | 30 | PK | Mohali | 103 | members | pid | tid | |---|---| | 1 | 10 | | 2 | 30 | | 3 | 10 | | 4 | 20 | ``` SELECT MIN(P.age) FROM player P WHERE P.pid IN ( SELECT M.pid FROM team T, coach C, members M WHERE C.cname = 'Mark' AND T.cid = C.cid AND M.tid = T.tid ) ``` The value returned by the given SQL query is ______ . (Answer in integer)

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      In a B$^{+}$- tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:

      A = (49, 77, 83, -), B = (7, 19, 33, 44), C = (20*, 22*, 25*, 26*)

      The *-marked keys signify that these are data entries in a leaf.

      Assume that a pointer between keys k1k_1 and k2k_2 points to a subtree containing keys in [k1,k2)[k_1, k_2), and that when a leaf is created, the smallest key in it is copied up into its parent.

      A record with key value 23 is inserted into the B$^{+}$- tree.

      The smallest key value in the parent of the leaf that contains 25* is __________. (Answer in integer)

    19. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Once the DBMS informs the user that a transaction has been successfully completed, its effect should persist even if the system crashes before all its changes are reflected on disk. This property is called

      1. (a) durability
      2. (b) atomicity
      3. (c) consistency
      4. (d) isolation
      Show answer

      (a) durability

    20. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Let S be the specification: "Instructors teach courses. Students register for courses. Courses are allocated classrooms. Instructors guide students." Which one of the following ER diagrams CORRECTLY represents S?

      1. (a) (i)
      2. (b) (ii)
      3. (c) (iii)
      4. (d) (iv)
      Show answer

      (d) (iv)

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one of the following statements is TRUE?

      1. (a) The weak entity set MUST have total participation in the identifying relationship
      2. (b) The owner entity set MUST have total participation in the identifying relationship
      3. (c) Both weak and owner entity sets MUST have total participation in the identifying relationship
      4. (d) Neither weak entity set nor owner entity set MUST have total participation in the identifying relationship
      Show answer

      (a) The weak entity set MUST have total participation in the identifying relationship

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      In a B+ tree, the requirement of at least half-full (50%) node occupancy is relaxed for which one of the following cases?

      1. (a) Only the root node
      2. (b) All leaf nodes
      3. (c) All internal nodes
      4. (d) Only the leftmost leaf node
      Show answer

      (a) Only the root node

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following statements about a relation R in first normal form (1NF) is/are TRUE ?

      1. (a) R can have a multi-attribute key
      2. (b) R cannot have a foreign key
      3. (c) R cannot have a composite attribute
      4. (d) R cannot have more than one candidate key
      Show answer

      ()

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following file organizations is/are I/O efficient for the scan operation in DBMS?

      1. (a) Sorted
      2. (b) Heap
      3. (c) Unclustered tree index
      4. (d) Unclustered hash index
      Show answer

      ()

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?

      1. (a) 2PL permits only serializable schedules
      2. (b) With 2PL, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation
      3. (c) With 2PL, once a lock is released on any data item inside a transaction, no more locks on any data item can be obtained inside that transaction
      4. (d) A deadlock is possible with 2PL
      Show answer

      ()

    26. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following two relations, R(A,B)\boldsymbol{R(A,B)} and S(A,C)\boldsymbol{S(A,C)}:

      R:

      | A | B |
      |---|---|
      | 10 | 20 |
      | 20 | 30 |
      | 30 | 40 |
      | 30 | 50 |
      | 50 | 95 |

      S:

      | A | C |
      |---|---|
      | 10 | 90 |
      | 30 | 45 |
      | 40 | 80 |

      The total number of tuples obtained by evaluating the following expression



      σB<C(R⋈R.A=S.AS)\sigma_{B<C}(R \bowtie_{R.A=S.A} S)




      is _________

    27. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The symbol → indicates functional dependency in the context of a relational database. Which of the following options is/are TRUE?

      1. (a) (X,Y)→(Z,W)(X, Y) \to (Z, W) implies X→(Z,W)X \to (Z, W)
      2. (b) (X,Y)→(Z,W)(X, Y) \to (Z, W) implies (X,Y)→Z(X, Y) \to Z
      3. (c) ((X,Y)→Z((X, Y) \to Z and W→Y)W \to Y) implies (X,W)→Z(X, W) \to Z
      4. (d) (X→Y(X \to Y and Y→Z)Y \to Z) implies X→ZX \to Z
      Show answer

      ()

    28. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      The relation schema, Person(pid,city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename. To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is

      1. (a) 1
      2. (b) 2
      3. (c) 3
      4. (d) 4
      Show answer

      (b) 2

    29. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the following read-write schedule SS over three transactions T1T_1, T2T_2, and T3T_3, where the subscripts in the schedule indicate transaction IDs:



      S:r1(z); w1(z); r2(x); r3(y); w3(y); r2(y); w2(x); w2(y);S: r_1(z);\ w_1(z);\ r_2(x);\ r_3(y);\ w_3(y);\ r_2(y);\ w_2(x);\ w_2(y);




      Which of the following transaction schedules is/are conflict equivalent to SS ?

      1. (a) T1T2T3T_1T_2T_3
      2. (b) T1T3T2T_1T_3T_2
      3. (c) T3T2T1T_3T_2T_1
      4. (d) T3T1T2T_3T_1T_2
      Show answer

      ()

    30. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A functional dependency F:X→YF: X \to Y is termed as a *useful functional dependency* if and only if it satisfies all the following three conditions:

      - XX is not the empty set.
      - YY is not the empty set.
      - Intersection of XX and YY is the empty set.

      For a relation RR with 4 attributes, the total number of possible useful functional dependencies is ________

    31. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the options given below refers to the degree (or arity) of a relation in relational database systems?

      1. (a) Number of attributes of its relation schema.
      2. (b) Number of tuples stored in the relation.
      3. (c) Number of entries in the relation.
      4. (d) Number of distinct domains of its relation schema.
      Show answer

      (a) Number of attributes of its relation schema.

    32. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following table named Student in a relational database. The primary key of this table is rollNum. Student | rollNum | name | gender | marks | |---|---|---|---| | 1 | Naman | M | 62 | | 2 | Aliya | F | 70 | | 3 | Aliya | F | 80 | | 4 | James | M | 82 | | 5 | Swati | F | 65 | The SQL query below is executed on this database. ```sql SELECT * FROM Student WHERE gender = ‘F’ AND marks > 65; ``` The number of rows returned by the query is ____________.

    33. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a database of fixed-length records, stored as an ordered file. The database has 25,000 records, with each record being 100 bytes, of which the primary key occupies 15 bytes. The data file is block-aligned in that each data record is fully contained within a block. The database is indexed by a primary index file, which is also stored as a block-aligned ordered file. The figure below depicts this indexing scheme.

      Suppose the block size of the file system is 1024 bytes, and a pointer to a block occupies 5 bytes. The system uses binary search on the index file to search for a record with a given key. You may assume that a binary search on an index file of bb blocks takes ⌈log⁡2b⌉\lceil \log_2 b \rceil block accesses in the worst case.

      Given a key, the number of block accesses required to identify the block in the data file that may contain a record with the key, in the worst case, is ____________.

    34. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      1. (a) A relation with only two attributes is always in BCNF.
      2. (b) If all attributes of a relation are prime attributes, then the relation is in BCNF.
      3. (c) Every relation has at least one non-prime attribute.
      4. (d) BCNF decompositions preserve functional dependencies.
      Show answer

      (a) A relation with only two attributes is always in BCNF.

    35. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following three relations in a relational database.

      Employee(eId‾,Name)\mathit{Employee}(\underline{\mathit{eId}}, \mathit{Name}), Brand(bId‾,bName)\mathit{Brand}(\underline{\mathit{bId}}, \mathit{bName}), Own(eId‾,bId‾)\mathit{Own}(\underline{\mathit{eId}}, \underline{\mathit{bId}})

      Which of the following relational algebra expressions return the set of $\mathit{eId}$s who own all the brands?

      1. (a) ΠeId(ΠeId,bId(Own)/ΠbId(Brand))\Pi_{\mathit{eId}}(\Pi_{\mathit{eId},\mathit{bId}}(\mathit{Own}) / \Pi_{\mathit{bId}}(\mathit{Brand}))
      2. (b) ΠeId(Own)−ΠeId((ΠeId(Own)×ΠbId(Brand))−ΠeId,bId(Own))\Pi_{\mathit{eId}}(\mathit{Own}) - \Pi_{\mathit{eId}}\left((\Pi_{\mathit{eId}}(\mathit{Own}) \times \Pi_{\mathit{bId}}(\mathit{Brand})) - \Pi_{\mathit{eId},\mathit{bId}}(\mathit{Own})\right)
      3. (c) ΠeId(ΠeId,bId(Own)/ΠbId(Own))\Pi_{\mathit{eId}}(\Pi_{\mathit{eId},\mathit{bId}}(\mathit{Own}) / \Pi_{\mathit{bId}}(\mathit{Own}))
      4. (d) ΠeId((ΠeId(Own)×ΠbId(Own))/ΠbId(Brand))\Pi_{\mathit{eId}}\left((\Pi_{\mathit{eId}}(\mathit{Own}) \times \Pi_{\mathit{bId}}(\mathit{Own})) / \Pi_{\mathit{bId}}(\mathit{Brand})\right)
      Show answer

      ()

    36. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      AB→CAB \to C; BC→DBC \to D; C→EC \to E;

      The number of superkeys in the relation R is _____________.

    37. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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 a transaction TiT_i, respectively. Consider the schedule SS with four transactions.

      SS: R4(x)R2(x)R3(x)R1(y)W1(y)W2(x)W3(y)R4(y)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?

      1. (a) T1→T3→T4→T2T_1 \to T_3 \to T_4 \to T_2
      2. (b) T1→T4→T3→T2T_1 \to T_4 \to T_3 \to T_2
      3. (c) T4→T1→T3→T2T_4 \to T_1 \to T_3 \to T_2
      4. (d) T3→T1→T4→T2T_3 \to T_1 \to T_4 \to T_2
      Show answer

      (a) T1→T3→T4→T2T_1 \to T_3 \to T_4 \to T_2

    38. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the relational database with the following four schemas and their respective instances. Student(<u>sNo</u>, sName, dNo) Dept(<u>dNo</u>, dName) Course(<u>cNo</u>, cName, dNo) Register(<u>sNo</u>, <u>cNo</u>) **Student** | sNo | sName | dNo | |---|---|---| | S01 | James | D01 | | S02 | Rocky | D01 | | S03 | Jackson | D02 | | S04 | Jane | D01 | | S05 | Milli | D02 | **Dept** | dNo | dName | |---|---| | D01 | CSE | | D02 | EEE | **Course** | cNo | cName | dNo | |---|---|---| | C11 | DS | D01 | | C12 | OS | D01 | | C21 | DE | D02 | | C22 | PT | D02 | | C23 | CV | D03 | **Register** | sNo | cNo | |---|---| | S01 | C11 | | S01 | C12 | | S02 | C11 | | S03 | C21 | | S03 | C22 | | S03 | C23 | | S04 | C11 | | S04 | C12 | | S05 | C11 | | S05 | C21 | **SQL Query:** ```sql SELECT * FROM Student AS S WHERE NOT EXIST (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___________.

    39. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

      (d) Both S1 and S2 are false.

    40. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery. Which of the following statements is/are correct?

      1. (a) The same undo and redo list will be used while recovering again.
      2. (b) The system cannot recover any further.
      3. (c) All the transactions that are already undone and redone will not be recovered again.
      4. (d) The database will become inconsistent.
      Show answer

      (a) The same undo and redo list will be used while recovering again.

    41. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

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

    42. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A relation r(A,B)r(A, B) in a relational database has 1200 tuples. The attribute AA has integer values ranging from 6 to 20, and the attribute BB has integer values ranging from 1 to 20. Assume that the attributes AA and BB are independently distributed.

      The estimated number of tuples in the output of σ(A>10)∨(B=18)(r)\sigma_{(A > 10) \vee (B = 18)}(r) is ______.

    43. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

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



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




      Consider the following relational algebra expression:



      ΠempNo(empAge⋈(age>age1)ρempNo1, age1(empAge))\Pi_{\mathit{empNo}}\left(\mathit{empAge} \bowtie_{(\mathit{age} > \mathit{age1})} \rho_{\mathit{empNo1},\, \mathit{age1}}(\mathit{empAge})\right)




      What does the above expression generate?

      1. (a) Employee numbers of only those employees whose age is the maximum.
      2. (b) Employee numbers of only those employees whose age is more than the age of exactly one other employee.
      3. (c) Employee numbers of all employees whose age is not the minimum.
      4. (d) Employee numbers of all employees whose age is the minimum.
      Show answer

      (c) Employee numbers of all employees whose age is not the minimum.

    44. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

      (b) employees in the company.

    45. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

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

      S1S_1: r1(x) r1(y) r2(x) r2(y) w2(y) w1(x)r_1(x)\ r_1(y)\ r_2(x)\ r_2(y)\ w_2(y)\ w_1(x)

      S2S_2: r1(x) r2(x) r2(y) w2(y) r1(y) w1(x)r_1(x)\ r_2(x)\ r_2(y)\ w_2(y)\ r_1(y)\ w_1(x)

      Which one of the following options is correct?

      1. (a) S1S_1 is conflict serializable, and S2S_2 is not conflict serializable.
      2. (b) S1S_1 is not conflict serializable, and S2S_2 is conflict serializable.
      3. (c) Both S1S_1 and S2S_2 are conflict serializable.
      4. (d) Neither S1S_1 nor S2S_2 is conflict serializable.
      Show answer

      (b) S1S_1 is not conflict serializable, and S2S_2 is conflict serializable.

    46. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Let S be the following schedule of operations of three transactions T1T_1, T2T_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 P and Q below:

      P: S is conflict-serializable.
      Q: If T3T_3 commits before T1T_1 finishes, then S is recoverable.

      Which one of the following choices is correct?

      1. (a) Both P and Q are true.
      2. (b) P is true and Q is false.
      3. (c) P is false and Q is true.
      4. (d) Both P and Q are false.
      Show answer

      (b) P is true and Q is false.

    47. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

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



      PQ→X; P→YX; Q→Y; Y→ZWPQ \rightarrow X;\ P \rightarrow YX;\ Q \rightarrow Y;\ Y \rightarrow ZW




      Consider the decomposition of the relation RR into the constituent relations according to the following two decomposition schemes.

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

      Which one of the following options is correct?

      1. (a) D1D_1 is a lossless decomposition, but D2D_2 is a lossy decomposition.
      2. (b) D1D_1 is a lossy decomposition, but D2D_2 is a lossless decomposition.
      3. (c) Both D1D_1 and D2D_2 are lossless decompositions.
      4. (d) Both D1D_1 and D2D_2 are lossy decompositions.
      Show answer

      (a) D1D_1 is a lossless decomposition, but D2D_2 is a lossy decomposition.

    48. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Suppose the following functional dependencies hold on a relation U with attributes PP, QQ, RR, SS, and TT:



      P→QRP \to QR





      RS→TRS \to T




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

      1. (a) PS→TPS \to T
      2. (b) R→TR \to T
      3. (c) P→RP \to R
      4. (d) PS→QPS \to Q
      Show answer

      ()

    49. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider a relational database containing the following schemas.

      Catalogue

      | sno‾\underline{\text{sno}} | pno‾\underline{\text{pno}} | cost |
      |---|---|---|
      | S1 | P1 | 150 |
      | S1 | P2 | 50 |
      | S1 | P3 | 100 |
      | S2 | P4 | 200 |
      | S2 | P5 | 250 |
      | S3 | P1 | 250 |
      | S3 | P2 | 150 |
      | S3 | P5 | 300 |
      | S3 | P4 | 250 |

      Suppliers

      | sno‾\underline{\text{sno}} | sname | location |
      |---|---|---|
      | S1 | M/s Royal furniture | Delhi |
      | S2 | M/s Balaji furniture | Bangalore |
      | S3 | M/s Premium furniture | Chennai |

      Parts

      | pno‾\underline{\text{pno}} | pname | part_spec |
      |---|---|---|
      | P1 | Table | Wood |
      | P2 | Chair | Wood |
      | P3 | Table | Steel |
      | P4 | Almirah | Steel |
      | P5 | Almirah | Wood |

      The primary key of each table is indicated by underlining the constituent fields.

      ```
      SELECT s.sno, s.sname
      FROM Suppliers s, Catalogue c
      WHERE s.sno = c.sno AND
      cost > (SELECT AVG (cost)
      FROM Catalogue
      WHERE pno = 'P4'
      GROUP BY pno);
      ```

      The number of rows returned by the above SQL query is

      1. (a) 4
      2. (b) 5
      3. (c) 0
      4. (d) 2
      Show answer

      (a) 4

    50. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?

      1. (a) Diamonds with double/bold border
      2. (b) Rectangles with double/bold border
      3. (c) Ovals with double/bold border
      4. (d) Ovals that contain underlined identifiers
      Show answer

      (a) Diamonds with double/bold border

    51. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a relational table RR that is in 3NF, but not in BCNF. Which one of the following statements is TRUE?

      1. (a) RR has a nontrivial functional dependency X→AX \to A, where XX is not a superkey and AA is a prime attribute.
      2. (b) RR has a nontrivial functional dependency X→AX \to A, where XX is not a superkey and AA is a non-prime attribute and XX is not a proper subset of any key.
      3. (c) RR has a nontrivial functional dependency X→AX \to A, where XX is not a superkey and AA is a non-prime attribute and XX is a proper subset of some key.
      4. (d) A cell in RR holds a set instead of an atomic value.
      Show answer

      (a) RR has a nontrivial functional dependency X→AX \to A, where XX is not a superkey and AA is a prime attribute.

    52. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a schedule of transactions T1T_1 and T2T_2:

      | T1T_1 | RA | | | RC | | WD | | WB | Commit | |
      |---|---|---|---|---|---|---|---|---|---|---|
      | T2T_2 | | RB | WB | | RD | | WC | | | Commit |

      Here, RX stands for "Read(X)" and WX stands for "Write(X)". Which one of the following schedules is conflict equivalent to the above schedule?

      1. (a) | T1T_1 | | | | RA | RC | WD | WB | | Commit | |
        |---|---|---|---|---|---|---|---|---|---|---|
        | T2T_2 | RB | WB | RD | | | | | WC | | Commit |
      2. (b) | T1T_1 | RA | RC | WD | WB | | | | | Commit | |
        |---|---|---|---|---|---|---|---|---|---|---|
        | T2T_2 | | | | | RB | WB | RD | WC | | Commit |
      3. (c) | T1T_1 | RA | RC | WD | | | | WB | | Commit | |
        |---|---|---|---|---|---|---|---|---|---|---|
        | T2T_2 | | | | RB | WB | RD | | WC | | Commit |
      4. (d) | T1T_1 | | | | | RA | RC | WD | WB | Commit | |
        |---|---|---|---|---|---|---|---|---|---|---|
        | T2T_2 | RB | WB | RD | WC | | | | | | Commit |
      Show answer

      (a) | T1T_1 | | | | RA | RC | WD | WB | | Commit | |
      |---|---|---|---|---|---|---|---|---|---|---|
      | T2T_2 | RB | WB | RD | | | | | WC | | Commit |

    53. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database is \_\_\_\_\_\_\_.

    54. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following two statements about database transaction schedules: I. Strict two-phase locking protocol generates conflict serializable schedules that are also recoverable. II. Timestamp-ordering concurrency control protocol with Thomas' Write Rule can generate view serializable schedules that are not conflict serializable. Which of the above statements is/are TRUE?

      1. (a) I only
      2. (b) II only
      3. (c) Both I and II
      4. (d) Neither I nor II
      Show answer

      (c) Both I and II

    55. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which one of the following statements is NOT correct about the B+ tree data structure used for creating an index of a relational database table?

      1. (a) B+ Tree is a height-balanced tree
      2. (b) Non-leaf nodes have pointers to data records
      3. (c) Key values in each node are kept in sorted order
      4. (d) Each leaf node has a pointer to the next leaf node
      Show answer

      (b) Non-leaf nodes have pointers to data records

    56. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Let the set of functional dependencies F = {QR → S, R → P, S → Q} hold on a relation schema X = (PQRS). X is not in BCNF. Suppose X is decomposed into two schemas Y and Z, where Y = (PR) and Z = (QRS). Consider the two statements given below. I. Both Y and Z are in BCNF II. Decomposition of X into Y and Z is dependency preserving and lossless Which of the above statements is/are correct?

      1. (a) Both I and II
      2. (b) I only
      3. (c) II only
      4. (d) Neither I nor II
      Show answer

      (c) II only

    57. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      A relational database contains two tables Student and Performance as shown below: **Student** | Roll_no. | Student_name | |---|---| | 1 | Amit | | 2 | Priya | | 3 | Vinit | | 4 | Rohan | | 5 | Smita | **Performance** | Roll_no. | Subject_code | Marks | |---|---|---| | 1 | A | 86 | | 1 | B | 95 | | 1 | C | 90 | | 2 | A | 89 | | 2 | C | 92 | | 3 | C | 80 | The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together form the primary key. Consider the SQL query given below: ```sql SELECT S.Student_name, sum(P.Marks) FROM Student S, Performance P WHERE P.Marks > 84 GROUP BY S.Student_name; ``` The number of rows returned by the above SQL query is ________.

    58. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V).

      P

      | X | Y | Z |
      |---|---|---|
      | X1 | Y1 | Z1 |
      | X1 | Y1 | Z2 |
      | X2 | Y2 | Z2 |
      | X2 | Y4 | Z4 |

      Q

      | X | Y | T |
      |---|---|---|
      | X2 | Y1 | 2 |
      | X1 | Y2 | 5 |
      | X1 | Y1 | 6 |
      | X3 | Y3 | 1 |

      R

      | Y | V |
      |---|---|
      | Y1 | V1 |
      | Y3 | V2 |
      | Y2 | V3 |
      | Y2 | V2 |

      How many tuples will be returned by the following relational algebra query?



      ΠX(σ(P.Y=R.Y∧R.V=V2)(P×R))−ΠX(σ(Q.Y=R.Y∧Q.T>2)(Q×R))\Pi_X\left(\sigma_{(P.Y = R.Y \wedge R.V = V2)}(P \times R)\right) - \Pi_X\left(\sigma_{(Q.Y = R.Y \wedge Q.T > 2)}(Q \times R)\right)




      Answer: _________.

  11. 14Computer networks5 ch · 1 h 13 min60 PYQ
    1. Layering, OSI and TCP/IP, and switching 14′
    2. Data link layer: framing, error detection, MAC and Ethernet 16′
    3. IP addressing, CIDR, ARP, DHCP, ICMP, NAT and routing 17′
    4. Transport layer: UDP, TCP, flow and congestion control 13′
    5. Application layer: DNS, HTTP, SMTP, FTP and email 13′
    See the 60 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      With respect to a TCP connection between a client and a server, which one of the following statements is true?

      1. (a) The client and server use a two-way handshake mechanism before the start of data transmission
      2. (b) The server cannot initiate closing of the connection before the client initiates closing of the connection
      3. (c) The TCP connection is half-duplex
      4. (d) The client and server can initiate closing of the connection at the same time
      Show answer

      (d) The client and server can initiate closing of the connection at the same time

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Which of the following statements is/are true with respect to the interaction of a web browser with a web server using HTTP 1.1?

      1. (a) HTTP 1.1 facilitates downloading multiple objects of the same webpage over the same TCP connection, if the objects are stored in the same server
      2. (b) HTTP 1.1 facilitates downloading multiple objects of the same webpage over the same TCP connection, even if they are stored in different servers
      3. (c) HTTP 1.1 facilitates sending a request for downloading one object without waiting for a previously requested object to be downloaded completely
      4. (d) HTTP 1.1 facilitates downloading multiple webpages on the same server to be downloaded over a single TCP connection
      Show answer

      ()

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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=1061\text{M} = 10^6, 1k=1031\text{k} = 10^3

      1. (a) 731
      2. (b) 64
      3. (c) 8
      4. (d) 16
      Show answer

      (b) 64

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      1. (a) SMTP
      2. (b) FTP
      3. (c) DHCP
      4. (d) HTTP
      Show answer

      (c) DHCP

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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)

    6. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      1. (a) 011
      2. (b) 101
      3. (c) 000
      4. (d) 100
      Show answer

      (d) 100

    7. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      A TCP sender successfully establishes a connection with a TCP receiver and starts the transmission of segments. The TCP congestion control mechanism’s slow-start threshold is set to 10000 segments. Assume that the round-trip time is fixed at 1 millisecond. Assume that the sender always has data to send, the segments are numbered from 1, and no segment is lost. Let tt denote the time (in milliseconds) at which the transmission of segment number 2000 starts.

      Which one of the following options is correct?

      1. (a) 9≤t<109 \le t < 10
      2. (b) 10≤t<1110 \le t < 11
      3. (c) 11≤t<1211 \le t < 12
      4. (d) 12≤t<1312 \le t < 13
      Show answer

      (b) 10≤t<1110 \le t < 11

    8. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Consider the implementation of sliding window protocol over a lossless link, with a window size of WW frames, where each frame is of size 1000 bits (including header). The bandwidth of the link is 100 kbps (1k=1031\text{k} = 10^3) and the one-way propagation delay is 100 milliseconds. Assume that processing times at the sender and receiver are zero and the transmission time of acknowledgements is also zero. Which one of the following options gives the minimum size of WW (in number of frames) required to achieve 100% link utilization?

      1. (a) 10
      2. (b) 21
      3. (c) 20
      4. (d) 11
      Show answer

      (b) 21

    9. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      An ISP having an address block 202.16.0.0/15 assigns a block of 6000 IP addresses to a client, using the classless internet domain routing (CIDR) super-netting approach. Which of the following address blocks can be assigned by the ISP?

      1. (a) 202.16.0.0/19
      2. (b) 202.17.64.0/19
      3. (c) 202.16.32.0/19
      4. (d) 202.17.24.0/19
      Show answer

      ()

    10. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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=2101\text{K} = 2^{10}

    11. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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)

    12. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Identify the ONE CORRECT matching between the OSI layers and their corresponding functionalities as shown. | OSI Layers | Functionalities | |---|---| | (a) Network layer | (I) Packet routing | | (b) Transport layer | (II) Framing and error handling | | (c) Datalink layer | (III) Host to host communication |

      1. (a) (a)-(I), (b)-(II), (c)-(III)
      2. (b) (a)-(I), (b)-(III), (c)-(II)
      3. (c) (a)-(II), (b)-(I), (c)-(III)
      4. (d) (a)-(III), (b)-(II), (c)-(I)
      Show answer

      (b) (a)-(I), (b)-(III), (c)-(II)

    13. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the following statements: (i) Address Resolution Protocol (ARP) provides a mapping from an IP address to the corresponding hardware (link-layer) address. (ii) A single TCP segment from a sender S to a receiver R cannot carry both data from S to R and acknowledgement for a segment from R to S. Which ONE of the following is CORRECT?

      1. (a) Both (i) and (ii) are TRUE
      2. (b) (i) is TRUE and (ii) is FALSE
      3. (c) (i) is FALSE and (ii) is TRUE
      4. (d) Both (i) and (ii) are FALSE
      Show answer

      (b) (i) is TRUE and (ii) is FALSE

    14. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider the routing protocols given in List I and the names given in List II: | List I | List II | |---|---| | (i) Distance vector routing | (a) Bellman-Ford | | (ii) Link state routing | (b) Dijkstra | For matching of items in List I with those in List II, which ONE of the following options is CORRECT?

      1. (a) (i) – (a) and (ii) – (b)
      2. (b) (i) – (a) and (ii) – (a)
      3. (c) (i) – (b) and (ii) – (a)
      4. (d) (i) – (b) and (ii) – (b)
      Show answer

      (a) (i) – (a) and (ii) – (b)

    15. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      A machine receives an IPv4 datagram. The protocol field of the IPv4 header has the protocol number of a protocol X. Which ONE of the following is NOT a possible candidate for X?

      1. (a) Internet Control Message Protocol (ICMP)
      2. (b) Internet Group Management Protocol (IGMP)
      3. (c) Open Shortest Path First (OSPF)
      4. (d) Routing Information Protocol (RIP)
      Show answer

      (d) Routing Information Protocol (RIP)

    16. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the 3-way handshaking protocol for TCP connection establishment. Let the three packets exchanged during the connection establishment be denoted as P1, P2, and P3, in order. Which of the following option(s) is/are TRUE with respect to TCP header flags that are set in the packets?

      1. (a) P3: SYN = 1, ACK = 1
      2. (b) P2: SYN = 1, ACK = 1
      3. (c) P2: SYN = 0, ACK = 1
      4. (d) P1: SYN = 1
      Show answer

      ()

    17. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Consider a network that uses Ethernet and IPv4. Assume that IPv4 headers do not use any options field. Each Ethernet frame can carry a maximum of 1500 bytes in its data field. A UDP segment is transmitted. The payload (data) in the UDP segment is 7488 bytes. Which ONE of the following choices has the CORRECT total number of fragments transmitted and the size of the last fragment including IPv4 header?

      1. (a) 5 fragments, 1488 bytes
      2. (b) 6 fragments, 88 bytes
      3. (c) 6 fragments, 108 bytes
      4. (d) 6 fragments, 116 bytes
      Show answer

      (d) 6 fragments, 116 bytes

    18. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Suppose we are transmitting frames between two nodes using Stop-and-Wait protocol. The frame size is 3000 bits. The transmission rate of the channel is 2000 bps (bits/second) and the propagation delay between the two nodes is 100 milliseconds. Assume that the processing times at the source and destination are negligible. Also, assume that the size of the acknowledgement packet is negligible. Which ONE of the following most accurately gives the channel utilization for the above scenario in percentage?

      1. (a) 88.23
      2. (b) 93.75
      3. (c) 85.44
      4. (d) 66.67
      Show answer

      (a) 88.23

    19. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to? | Subnet Address | Subnet Mask (in CIDR notation) | Interface | |---|---|---| | 145.36.0.0 | /16 | E1 | | 145.36.128.0 | /17 | E2 | | 145.36.64.0 | /18 | E3 | | 145.36.255.0 | /24 | E4 | | Default | -- | E5 |

      1. (a) E3
      2. (b) E1
      3. (c) E2
      4. (d) E5
      Show answer

      (a) E3

    20. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Suppose a message of size 15000 bytes is transmitted from a source to a destination using IPv4 protocol via two routers as shown in the figure. Each router has a defined maximum transmission unit (MTU) as shown in the figure, including IP header. The number of fragments that will be delivered to the destination is ________ . (Answer in integer) Source → Router-1 (MTU=5000 bytes) → Router-2 (MTU=3000 bytes) → Destination

    21. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A user starts browsing a webpage hosted at a remote server. The browser opens a single TCP connection to fetch the entire webpage from the server. The webpage consists of a top-level index page with multiple embedded image objects. Assume that all caches (e.g., DNS cache, browser cache) are all initially empty. The following packets leave the user’s computer in some order. (i) HTTP GET request for the index page (ii) DNS request to resolve the web server’s name to its IP address (iii) HTTP GET request for an image object (iv) TCP SYN to open a connection to the web server Which one of the following is the CORRECT chronological order (earliest in time to latest) of the packets leaving the computer ?

      1. (a) (iv), (ii), (iii), (i)
      2. (b) (ii), (iv), (iii), (i)
      3. (c) (ii), (iv), (i), (iii)
      4. (d) (iv), (ii), (i), (iii)
      Show answer

      (c) (ii), (iv), (i), (iii)

    22. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Node X has a TCP connection open to node Y. The packets from X to Y go through an intermediate IP router R. Ethernet switch S is the first switch on the network path between X and R. Consider a packet sent from X to Y over this connection. Which of the following statements is/are TRUE about the destination IP and MAC addresses on this packet at the time it leaves X?

      1. (a) The destination IP address is the IP address of R
      2. (b) The destination IP address is the IP address of Y
      3. (c) The destination MAC address is the MAC address of S
      4. (d) The destination MAC address is the MAC address of Y
      Show answer

      (b) The destination IP address is the IP address of Y

    23. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following statements about IPv4 fragmentation is/are TRUE?

      1. (a) The fragmentation of an IP datagram is performed only at the source of the datagram
      2. (b) The fragmentation of an IP datagram is performed at any IP router which finds that the size of the datagram to be transmitted exceeds the MTU
      3. (c) The reassembly of fragments is performed only at the destination of the datagram
      4. (d) The reassembly of fragments is performed at all intermediate routers along the path from the source to the destination
      Show answer

      ()

    24. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      TCP client P successfully establishes a connection to TCP server Q. Let NPN_P denote the sequence number in the SYN sent from P to Q. Let NQN_Q denote the acknowledgement number in the SYN ACK from Q to P. Which of the following statements is/are CORRECT?

      1. (a) The sequence number NPN_P is chosen randomly by P
      2. (b) The sequence number NPN_P is always 0 for a new connection
      3. (c) The acknowledgement number NQN_Q is equal to NPN_P
      4. (d) The acknowledgement number NQN_Q is equal to NP+1N_P + 1
      Show answer

      ()

    25. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Which of the following fields is/are modified in the IP header of a packet going out of a network address translation (NAT) device from an internal network to an external network?

      1. (a) Source IP
      2. (b) Destination IP
      3. (c) Header Checksum
      4. (d) Total Length
      Show answer

      ()

    26. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?

      1. (a) Source IP Address
      2. (b) Protocol
      3. (c) Time to Live (TTL)
      4. (d) Header Checksum
      Show answer

      ()

    27. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider a network path P—Q—R between nodes P and R via router Q. Node P sends a file of size 10610^6 bytes to R via this path by splitting the file into chunks of 10310^3 bytes each. Node P sends these chunks one after the other without any wait time between the successive chunk transmissions. Assume that the size of extra headers added to these chunks is negligible, and that the chunk size is less than the MTU.

      Each of the links P—Q and Q—R has a bandwidth of 10610^6 bits/sec, and negligible propagation latency. Router Q immediately transmits every packet it receives from P to R, with negligible processing and queueing delays. Router Q can simultaneously receive on link P—Q and transmit on link Q—R.

      Assume P starts transmitting the chunks at time t=0t = 0. Which one of the following options gives the time (*in seconds, rounded off to 3 decimal places*) at which R receives all the chunks of the file?

      1. (a) 8.000
      2. (b) 8.008
      3. (c) 15.992
      4. (d) 16.000
      Show answer

      (b) 8.008

    28. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?

      1. (a) 10.12.2.0/23
      2. (b) 10.12.2.0/24
      3. (c) 10.12.0.0/22
      4. (d) 10.12.2.0/22
      Show answer

      (a) 10.12.2.0/23

    29. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider a TCP connection operating at a point of time with the congestion window of size 12 MSS (Maximum Segment Size), when a timeout occurs due to packet loss. Assuming that all the segments transmitted in the next two RTTs (Round Trip Time) are acknowledged correctly, the congestion window size (*in MSS*) during the third RTT will be _________

    30. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Consider an Ethernet segment with a transmission speed of 10810^8 bits/sec and a maximum segment length of 500 meters. If the speed of propagation of the signal in the medium is 2×1082\times10^8 meters/sec, then the minimum frame size (*in bits*) required for collision detection is _________

    31. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation “/N” in a prefix indicates a subnet mask with the most significant N bits set to 1. | Prefix | Next hop router | |---|---| | 10.1.1.0/24 | R1 | | 10.1.1.128/25 | R2 | | 10.1.1.64/26 | R3 | | 10.1.1.192/26 | R4 | This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205 . The number of packets forwarded via the next hop router R2 is _______

    32. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider sending an IP datagram of size 1420 bytes (including 20 bytes of IP header) from a sender to a receiver over a path of two links with a router between them. The first link (sender to router) has an MTU (Maximum Transmission Unit) size of 542 bytes, while the second link (router to receiver) has an MTU size of 360 bytes. The number of fragments that would be delivered at the receiver is ________

    33. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Suppose two hosts are connected by a point-to-point link and they are configured to use Stop-and-Wait protocol for reliable data transfer. Identify in which one of the following scenarios, the utilization of the link is the lowest.

      1. (a) Longer link length and lower transmission rate
      2. (b) Longer link length and higher transmission rate
      3. (c) Shorter link length and lower transmission rate
      4. (d) Shorter link length and higher transmission rate
      Show answer

      (b) Longer link length and higher transmission rate

    34. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which of the following statements is/are INCORRECT about the OSPF (Open Shortest Path First) routing protocol used in the Internet?

      1. (a) OSPF implements Bellman-Ford algorithm to find shortest paths.
      2. (b) OSPF uses Dijkstra’s shortest path algorithm to implement least-cost path routing.
      3. (c) OSPF is used as an inter-domain routing protocol.
      4. (d) OSPF implements hierarchical routing.
      Show answer

      ()

    35. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Suppose you are asked to design a new reliable byte-stream transport protocol like TCP. This protocol, named myTCP, runs over a 100 Mbps network with Round Trip Time of 150 milliseconds and the maximum segment lifetime of 2 minutes. Which of the following is/are valid lengths of the Sequence Number field in the myTCP header?

      1. (a) 30 bits
      2. (b) 32 bits
      3. (c) 34 bits
      4. (d) 36 bits
      Show answer

      ()

    36. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Suppose in a web browser, you click on the www.gate-2023.in URL. The browser cache is empty. The IP address for this URL is not cached in your local host, so a DNS lookup is triggered (by the local DNS server deployed on your local host) over the 3-tier DNS hierarchy in an iterative mode. No resource records are cached anywhere across all DNS servers. Let RTT denote the round trip time between your local host and DNS servers in the DNS hierarchy. The round trip time between the local host and the web server hosting www.gate-2023.in is also equal to RTT. The HTML file associated with the URL is small enough to have negligible transmission time and negligible rendering time by your web browser, which references 10 equally small objects on the same web server. Which of the following statements is/are CORRECT about the minimum elapsed time between clicking on the URL and your browser fully rendering it?

      1. (a) 7 RTTs, in case of non-persistent HTTP with 5 parallel TCP connections.
      2. (b) 5 RTTs, in case of persistent HTTP with pipelining.
      3. (c) 9 RTTs, in case of non-persistent HTTP with 5 parallel TCP connections.
      4. (d) 6 RTTs, in case of persistent HTTP with pipelining.
      Show answer

      ()

    37. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The forwarding table of a router is shown below. | Subnet Number | Subnet Mask | Interface ID | |---|---|---| | 200.150.0.0 | 255.255.0.0 | 1 | | 200.150.64.0 | 255.255.224.0 | 2 | | 200.150.68.0 | 255.255.255.0 | 3 | | 200.150.68.64 | 255.255.255.224 | 4 | | Default | | 0 | A packet addressed to a destination address 200.150.68.118 arrives at the router. It will be forwarded to the interface with ID ____________.

    38. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider an enterprise network with two Ethernet segments, a web server and a firewall, connected via three routers as shown below. What is the number of subnets inside the enterprise network?

      1. (a) 3
      2. (b) 12
      3. (c) 6
      4. (d) 8
      Show answer

      (c) 6

    39. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

    40. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider routing table of an organization’s router shown below: | Subnet Number | Subnet Mask | Next Hop | |---|---|---| | 12.20.164.0 | 255.255.252.0 | R1 | | 12.20.170.0 | 255.255.254.0 | R2 | | 12.20.168.0 | 255.255.254.0 | Interface 0 | | 12.20.166.0 | 255.255.254.0 | Interface 1 | | default | | R3 | Which of the following prefixes in CIDR notation can be collectively used to correctly aggregate all of the subnets in the routing table?

      1. (a) 12.20.164.0/20
      2. (b) 12.20.164.0/22
      3. (c) 12.20.164.0/21
      4. (d) 12.20.168.0/22
      Show answer

      ()

    41. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a network with three routers P, Q, R shown in the figure below. All the links have cost of unity. P — Q — R 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___________.

    42. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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_________.

    43. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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____________.

    44. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

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

    45. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following two statements.

      S1S_1: Destination MAC address of an ARP reply is a broadcast address.
      S2S_2: Destination MAC address of an ARP request is a broadcast address.

      Which one of the following choices is correct?

      1. (a) Both S1S_1 and S2S_2 are true.
      2. (b) S1S_1 is true and S2S_2 is false.
      3. (c) S1S_1 is false and S2S_2 is true.
      4. (d) Both S1S_1 and S2S_2 are false.
      Show answer

      (c) S1S_1 is false and S2S_2 is true.

    46. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is d8d7d6d5c8d4d3d2c4d1c2c1d_8d_7d_6d_5c_8d_4d_3d_2c_4d_1c_2c_1, where the data bits and the check bits are given in the following tables:

      Data bits:

      | d8d_8 | d7d_7 | d6d_6 | d5d_5 | d4d_4 | d3d_3 | d2d_2 | d1d_1 |
      |---|---|---|---|---|---|---|---|
      | 1 | 1 | 0 | xx | 0 | 1 | 0 | 1 |

      Check bits:

      | c8c_8 | c4c_4 | c2c_2 | c1c_1 |
      |---|---|---|---|
      | yy | 0 | 1 | 0 |

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

      1. (a) xx is 0 and yy is 0.
      2. (b) xx is 0 and yy is 1.
      3. (c) xx is 1 and yy is 0.
      4. (d) xx is 1 and yy is 1.
      Show answer

      (a) xx is 0 and yy is 0.

    47. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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 c2c1c0c_2c_1c_0 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
      Show answer

      (c) 100

    48. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A TCP server application is programmed to listen on port number PP on host SS. A TCP client is connected to the TCP server over the network.

      Consider that while the TCP connection was active, the server machine SS crashed and rebooted. Assume that the client does not use the TCP keepalive timer.

      Which of the following behaviors is/are possible?

      1. (a) If the client was waiting to receive a packet, it may wait indefinitely.
      2. (b) The TCP server application on SS can listen on PP after reboot.
      3. (c) If the client sends a packet after the server reboot, it will receive a RST segment.
      4. (d) If the client sends a packet after the server reboot, it will receive a FIN segment.
      Show answer

      ()

    49. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider two hosts PP and QQ connected through a router RR. The maximum transfer unit (MTU) value of the link between PP and RR is 1500 bytes, and between RR and QQ is 820 bytes.

      A TCP segment of size 1400 bytes was transferred from PP to QQ through RR, with IP identification value as 0x1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to be fragmented, i.e., Don't Fragment (DF) flag in the IP header is *not* set by PP.

      Which of the following statements is/are correct?

      1. (a) Two fragments are created at RR and the IP datagram size carrying the second fragment is 620 bytes.
      2. (b) If the second fragment is lost, RR will resend the fragment with the IP identification value 0x1234.
      3. (c) If the second fragment is lost, PP is required to resend the whole TCP segment.
      4. (d) TCP destination port can be determined by analysing *only* the second fragment.
      Show answer

      ()

    50. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

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

      1. (a) The distance from RR to PP will be stored as 10.
      2. (b) The distance from RR to QQ will be stored as 7.
      3. (c) The next hop router for a packet from RR to PP is YY.
      4. (d) The next hop router for a packet from RR to QQ is ZZ.
      Show answer

      ()

    51. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following:
      - The time taken for processing the data frame by the receiver is negligible.
      - The time taken for processing the acknowledgement frame by the sender is negligible.
      - The sender has infinite number of frames available for transmission.
      - The size of the data frame is 2,000 bits and the size of the acknowledgement frame is 10 bits.
      - The link data rate in each direction is 1 Mbps (=106= 10^6 bits per second).
      - One way propagation delay of the link is 100 milliseconds.

      The minimum value of the sender's window size in terms of the number of frames, (rounded to the nearest integer) needed to achieve a link utilization of 50% is ______.

    52. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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 (=106= 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 __________.

    53. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Consider the following statements about the functionality of an IP based router. I. A router does not modify the IP packets during forwarding. II. It is not necessary for a router to implement any routing protocol. III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet. Which of the above statements is/are TRUE?

      1. (a) I and II only
      2. (b) I only
      3. (c) II and III only
      4. (d) II only
      Show answer

      (d) II only

    54. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Assume that you have made a request for a web page through your web browser to a web server. Initially the browser cache is empty. Further, the browser is configured to send HTTP requests in non-persistent mode. The web page contains text and five very small images. The minimum number of TCP connections required to display the web page completely in your browser is \_\_\_\_\_\_\_.

    55. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      An organization requires a range of IP addresses to assign one to each of its 1500 computers. The organization has approached an Internet Service Provider (ISP) for this task. The ISP uses CIDR and serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an address space to the organization which will minimize the number of routing entries in the ISP's router using route aggregation. Which of the following address spaces are potential candidates from which the ISP can allot any one to the organization? I. 202.61.84.0/21 II. 202.61.104.0/21 III. 202.61.64.0/21 IV. 202.61.144.0/21

      1. (a) I and II only
      2. (b) II and III only
      3. (c) III and IV only
      4. (d) I and IV only
      Show answer

      (b) II and III only

    56. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider a TCP connection between a client and a server with the following specifications: the round trip time is 6 ms, the size of the receiver advertised window is 50 KB, slow-start threshold at the client is 32 KB, and the maximum segment size is 2 KB. The connection is established at time t=0t = 0. Assume that there are no timeouts and errors during transmission. Then the size of the congestion window (in KB) at time t+60t + 60 ms after all acknowledgements are processed is \_\_\_\_\_\_\_\_.

    57. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Which of the following protocol pairs can be used to send and retrieve e-mails (in that order)?

      1. (a) IMAP, POP3
      2. (b) SMTP, POP3
      3. (c) SMTP, MIME
      4. (d) IMAP, SMTP
      Show answer

      (b) SMTP, POP3

    58. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider three machines M, N, and P with IP addresses 100.10.5.2, 100.10.5.5, and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true?

      1. (a) M, N, and P all belong to the same subnet
      2. (b) Only M and N belong to the same subnet
      3. (c) Only N and P belong to the same subnet
      4. (d) M, N, and P belong to three different subnets
      Show answer

      (c) Only N and P belong to the same subnet

    59. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Suppose that in an IP-over-Ethernet network, a machine X wishes to find the MAC address of another machine Y in its subnet. Which one of the following techniques can be used for this?

      1. (a) X sends an ARP request packet to the local gateway's IP address which then finds the MAC address of Y and sends to X
      2. (b) X sends an ARP request packet to the local gateway's MAC address which then finds the MAC address of Y and sends to X
      3. (c) X sends an ARP request packet with broadcast MAC address in its local subnet
      4. (d) X sends an ARP request packet with broadcast IP address in its local subnet
      Show answer

      (c) X sends an ARP request packet with broadcast MAC address in its local subnet

    60. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider that 15 machines need to be connected in a LAN using 8-port Ethernet switches. Assume that these switches do not have any separate uplink ports. The minimum number of switches needed is_________.

  12. 15IT fundamentals, security and law1 ch · 17 min1 PYQ
    1. Cryptography and network security basics 17′
    See the 1 question GATE Computer Science and IT (CS) asked from this module
    1. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      In an RSA cryptosystem, the value of the public modulus parameter nn is 3007. If it is also known that φ(n)=2880\varphi(n) = 2880, where φ()\varphi() denotes Euler's Totient Function, then the prime factor of nn which is greater than 50 is ________________.

Aptitude (CSAT)10 modules47 ch10 h 17 min87 PYQ
  1. 16Number sense5 ch · 1 h 11 min2 PYQ
    1. Numbers and their relations: place value, kinds of numbers and orders of magnitude 15′
    2. Divisibility, factors, HCF and LCM 16′
    3. Fractions, decimals and simplification 14′
    4. Powers, roots and surds 13′
    5. Unit digits, remainders and number puzzles 13′
    See the 2 questions GATE Computer Science and IT (CS) asked from this module
    1. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Let p1p_1 and p2p_2 denote two arbitrary prime numbers. Which one of the following statements is correct for all values of p1p_1 and p2p_2 ?

      1. (a) p1+p2p_1 + p_2 is not a prime number.
      2. (b) p1p2p_1 p_2 is not a prime number.
      3. (c) p1+p2+1p_1 + p_2 + 1 is a prime number.
      4. (d) p1p2+1p_1 p_2 + 1 is a prime number.
      Show answer

      (b) p1p2p_1 p_2 is not a prime number.

    2. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      For positive non-zero real variables pp and qq, if



      log⁡(p2+q2)=log⁡p+log⁡q+2log⁡3,\log(p^2+q^2) = \log p + \log q + 2\log 3,




      then, the value of p4+q4p2q2\dfrac{p^4+q^4}{p^2q^2} is

      1. (a) 79
      2. (b) 81
      3. (c) 9
      4. (d) 83
      Show answer

      (a) 79

  2. 17Percentages and their family6 ch · 1 h 23 min8 PYQ
    1. Percentage 16′
    2. Profit, loss and discount 13′
    3. Simple and compound interest 14′
    4. Ratio, proportion and partnership 14′
    5. Averages 13′
    6. Mixtures and alligation 13′
    See the 8 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

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

      1. (a) 0
      2. (b) 5
      3. (c) 10
      4. (d) 20
      Show answer

      (a) 0

    2. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The average marks obtained by a class in an examination were calculated as 30.8. However, while checking the marks entered, the teacher found that the marks of one student were entered incorrectly as 24 instead of 42. After correcting the marks, the average becomes 31.4. How many students does the class have?

      1. (a) 25
      2. (b) 28
      3. (c) 30
      4. (d) 32
      Show answer

      (c) 30

    3. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      If two distinct non-zero real variables xx and yy are such that (x+y)(x+y) is proportional to (x−y)(x-y) then the value of xy\dfrac{x}{y}

      1. (a) depends on xyxy
      2. (b) depends only on xx and not on yy
      3. (c) depends only on yy and not on xx
      4. (d) is a constant
      Show answer

      (d) is a constant

    4. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The number of coins of ₹1, ₹5, and ₹10 denominations that a person has are in the ratio 5:3:13. Of the total amount, the percentage of money in ₹5 coins is

      1. (a) 21%
      2. (b) 142714\dfrac{2}{7}%
      3. (c) 10%
      4. (d) 30%
      Show answer

      (c) 10%

    5. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A person sold two different items at the same price. He made 10% profit in one item, and 10% loss in the other item. In selling these two items, the person made a total of

      1. (a) 1% profit
      2. (b) 2% profit
      3. (c) 1% loss
      4. (d) 2% loss
      Show answer

      (c) 1% loss

    6. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The ratio of boys to girls in a class is 7 to 3. Among the options below, an acceptable value for the total number of students in the class is:

      1. (a) 21
      2. (b) 37
      3. (c) 50
      4. (d) 73
      Show answer

      (c) 50

    7. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      | Items | Cost (₹) | Profit % | Marked Price (₹) |
      |---|---|---|---|
      | P | 5,400 | --- | 5,860 |
      | Q | --- | 25 | 10,000 |

      Details of prices of two items P and Q are presented in the above table. The ratio of cost of item P to cost of item Q is 3:4. Discount is calculated as the difference between the marked price and the selling price. The profit percentage is calculated as the ratio of the difference between selling price and cost, to the cost (Profit %=Selling price−CostCost×100)\left(\text{Profit } \% = \dfrac{\text{Selling price} - \text{Cost}}{\text{Cost}} \times 100\right).

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

      1. (a) 25
      2. (b) 12.5
      3. (c) 10
      4. (d) 5
      Show answer

      (c) 10

    8. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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
      Show answer

      (c) 88

  3. 18Time, work and motion4 ch · 54 min1 PYQ
    1. Time and work, pipes and cisterns 15′
    2. Speed, time and distance 13′
    3. Trains, boats and streams, races 13′
    4. Ages and word problems 13′
    See the 1 question GATE Computer Science and IT (CS) asked from this module
    1. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Two cars start at the same time from the same location and go in the same direction. The speed of the first car is 50 km/h and the speed of the second car is 60 km/h. The number of hours it takes for the distance between the two cars to be 20 km is ___.

      1. (a) 1
      2. (b) 2
      3. (c) 3
      4. (d) 6
      Show answer

      (b) 2

  4. 19Algebra, geometry and counting6 ch · 1 h 13 min29 PYQ
    1. Linear and quadratic equations, inequalities 13′
    2. Arithmetic and geometric progressions 12′
    3. Geometry: lines, triangles, polygons and circles 12′
    4. Mensuration: areas, surfaces and volumes 12′
    5. Counting: permutations and combinations 12′
    6. Probability 12′
    See the 29 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      Consider a knock-out women’s badminton singles tournament where there are no ties. The loser in each game is eliminated from the tournament. Every player plays until she is defeated or remains the last undefeated player. The last undefeated player is declared the winner of the tournament. If there are 64 players in the beginning of the tournament, how many games should be played in total to declare the winner of the tournament?

      1. (a) 127
      2. (b) 64
      3. (c) 63
      4. (d) 32
      Show answer

      (c) 63

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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?

      1. (a) 1/4
      2. (b) 3/4
      3. (c) 2/3
      4. (d) 3/8
      Show answer

      (a) 1/4

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      A student needs to enroll for a minimum of 60 credits. A student cannot enroll for more than 70 credits. The credits are divided amongst project and three distinct sets of courses namely, core courses, specialization courses, and elective courses. It is compulsory for a student to enroll for exactly 15 credits of core courses and exactly 20 credits of project. In addition, a student has to enroll for a minimum of 10 credits of specialization courses. The maximum credits of elective courses that a student can enroll for is ______

      1. (a) 10
      2. (b) 15
      3. (c) 20
      4. (d) 25
      Show answer

      (d) 25

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 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 number appearing in the second roll is an integer multiple of the number appearing in the first roll is __________

      1. (a) 16\dfrac{1}{6}
      2. (b) 518\dfrac{5}{18}
      3. (c) 718\dfrac{7}{18}
      4. (d) 56\dfrac{5}{6}
      Show answer

      (c) 718\dfrac{7}{18}

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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 ________

      1. (a) 336\dfrac{3}{36}
      2. (b) 1336\dfrac{13}{36}
      3. (c) 1536\dfrac{15}{36}
      4. (d) 1936\dfrac{19}{36}
      Show answer

      (c) 1536\dfrac{15}{36}

    6. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      If Pex=Qe−xPe^{x} = Qe^{-x} for all real values of xx, which one of the following statements is true?

      1. (a) P=Q=0P = Q = 0
      2. (b) P=Q=1P = Q = 1
      3. (c) P=1; Q=−1P = 1;\ Q = -1
      4. (d) PQ=0\dfrac{P}{Q} = 0
      Show answer

      (a) P=Q=0P = Q = 0

    7. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      In the diagram, the lines QR and ST are parallel to each other. The shortest distance between these two lines is half the shortest distance between the point P and line QR. What is the ratio of the area of the triangle PST to the area of the trapezium SQRT? Note: The figure shown is representative.

      1. (a) 13\dfrac{1}{3}
      2. (b) 14\dfrac{1}{4}
      3. (c) 25\dfrac{2}{5}
      4. (d) 12\dfrac{1}{2}
      Show answer

      (a) 13\dfrac{1}{3}

    8. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A fair six-faced dice, with the faces labelled ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, and ‘6’, is rolled thrice. What is the probability of rolling ‘6’ exactly once?

      1. (a) 75216\dfrac{75}{216}
      2. (b) 16\dfrac{1}{6}
      3. (c) 118\dfrac{1}{18}
      4. (d) 25216\dfrac{25}{216}
      Show answer

      (a) 75216\dfrac{75}{216}

    9. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      In the given figure, PQRS is a square of side 2 cm and PLMN is a rectangle. The corner L of the rectangle is on the side QR. Side MN of the rectangle passes through the corner S of the square. What is the area (in cm$^{2}$) of the rectangle PLMN? Note: The figure shown is representative.

      1. (a) 222\sqrt{2}
      2. (b) 22
      3. (c) 88
      4. (d) 44
      Show answer

      (d) 44

    10. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A shop has 4 distinct flavors of ice-cream. One can purchase any number of scoops of any flavor. The order in which the scoops are purchased is inconsequential. If one wants to purchase 3 scoops of ice-cream, in how many ways can one make that purchase?

      1. (a) 4
      2. (b) 20
      3. (c) 24
      4. (d) 48
      Show answer

      (b) 20

    11. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Two wizards try to create a spell using all the four elements, water, air, fire, and earth. For this, they decide to mix all these elements in all possible orders. They also decide to work independently. After trying all possible combination of elements, they conclude that the spell does not work. How many attempts does each wizard make before coming to this conclusion, independently?

      1. (a) 24
      2. (b) 48
      3. (c) 16
      4. (d) 12
      Show answer

      (a) 24

    12. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      For positive non-zero real variables xx and yy, if


      ln⁡(x+y2)=12[ln⁡(x)+ln⁡(y)]\ln\left(\frac{x+y}{2}\right) = \frac{1}{2}[\ln(x) + \ln(y)]



      then, the value of xy+yx\dfrac{x}{y} + \dfrac{y}{x} is

      1. (a) 1
      2. (b) 1/2
      3. (c) 2
      4. (d) 4
      Show answer

      (c) 2

    13. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A rectangular paper sheet of dimensions 54 cm × 4 cm is taken. The two longer edges of the sheet are joined together to create a cylindrical tube. A cube whose surface area is equal to the area of the sheet is also taken. Then, the ratio of the volume of the cylindrical tube to the volume of the cube is

      1. (a) 1/π1/\pi
      2. (b) 2/π2/\pi
      3. (c) 3/π3/\pi
      4. (d) 4/π4/\pi
      Show answer

      (a) 1/π1/\pi

    14. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A rectangular paper of 20 cm × 8 cm is folded 3 times. Each fold is made along the line of symmetry, which is perpendicular to its long edge. The perimeter of the final folded sheet (in cm) is

      1. (a) 18
      2. (b) 24
      3. (c) 20
      4. (d) 21
      Show answer

      (a) 18

    15. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Looking at the surface of a smooth 3-dimensional object from the outside, which one of the following options is TRUE?

      1. (a) The surface of the object must be concave everywhere.
      2. (b) The surface of the object must be convex everywhere.
      3. (c) The surface of the object may be concave in some places and convex in other places.
      4. (d) The object can have edges, but no corners.
      Show answer

      (c) The surface of the object may be concave in some places and convex in other places.

    16. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Consider two functions of time (tt),



      f(t)=0.01 t2f(t) = 0.01\,t^2





      g(t)=4 tg(t) = 4\,t




      where 0<t<∞0 < t < \infty.

      Now consider the following two statements:

      (i) For some t>0t > 0, g(t)>f(t)g(t) > f(t).

      (ii) There exists a TT, such that f(t)>g(t)f(t) > g(t) for all t>Tt > T.

      Which one of the following options is TRUE?

      1. (a) only (i) is correct
      2. (b) only (ii) is correct
      3. (c) both (i) and (ii) are correct
      4. (d) neither (i) nor (ii) is correct
      Show answer

      (c) both (i) and (ii) are correct

    17. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      f(x)f(x) and g(y)g(y) are functions of xx and yy, respectively, and f(x)=g(y)f(x) = g(y) for all real values of xx and yy. Which one of the following options is *necessarily* TRUE for all xx and yy?

      1. (a) f(x)=0f(x) = 0 and g(y)=0g(y) = 0
      2. (b) f(x)=g(y)=f(x) = g(y) = constant
      3. (c) f(x)≠f(x) \ne constant and g(y)≠g(y) \ne constant
      4. (d) f(x)+g(y)=f(x)−g(y)f(x) + g(y) = f(x) - g(y)
      Show answer

      (b) f(x)=g(y)=f(x) = g(y) = constant

    18. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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



      y(x)={2if 0≤x<133if 13≤x<341if 34≤x≤1y(x) = \begin{cases} 2 & \text{if } 0 \le x < \frac{1}{3} \\ 3 & \text{if } \frac{1}{3} \le x < \frac{3}{4} \\ 1 & \text{if } \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?

      1. (a) 56\dfrac{5}{6}
      2. (b) 65\dfrac{6}{5}
      3. (c) 136\dfrac{13}{6}
      4. (d) 613\dfrac{6}{13}
      Show answer

      (c) 136\dfrac{13}{6}

    19. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Let rr be a root of the equation x2+2x+6=0x^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

      1. (a) 5151
      2. (b) −51-51
      3. (c) 126126
      4. (d) −126-126
      Show answer

      (d) −126-126

    20. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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?

      1. (a) 12\dfrac{1}{2}
      2. (b) 825\dfrac{8}{25}
      3. (c) 1950\dfrac{19}{50}
      4. (d) 2350\dfrac{23}{50}
      Show answer

      (d) 2350\dfrac{23}{50}

    21. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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?

      1. (a) P cannot be placed at a corner
      2. (b) S cannot be placed at a corner
      3. (c) U cannot be placed at a mid-point
      4. (d) R cannot be placed at a corner
      Show answer

      (b) S cannot be placed at a corner

    22. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A polygon is convex if, for every pair of points, P and Q belonging to the polygon, the line segment PQ lies completely inside or on the polygon. Which one of the following is NOT a convex polygon?

      1. (a) [Figure: a chevron (arrow-head) shaped hexagon pointing right, with a notch cut into its left side]
      2. (b) [Figure: a triangle]
      3. (c) [Figure: a square]
      4. (d) [Figure: a trapezium with the shorter parallel side on top]
      Show answer

      (a) [Figure: a chevron (arrow-head) shaped hexagon pointing right, with a notch cut into its left side]

    23. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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⁡θ=\cos\theta =

      1. (a) 12\dfrac{1}{2}
      2. (b) 13\dfrac{1}{\sqrt{3}}
      3. (c) 12\dfrac{1}{\sqrt{2}}
      4. (d) 32\dfrac{\sqrt{3}}{2}
      Show answer

      (b) 13\dfrac{1}{\sqrt{3}}

    24. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

      (b) 4

    25. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      We have 2 rectangular sheets of paper, M and N, of dimensions 6 cm x 1 cm each. Sheet M is rolled to form an open cylinder by bringing the short edges of the sheet together. Sheet N is cut into equal square patches and assembled to form the largest possible closed cube. Assuming the ends of the cylinder are closed, the ratio of the volume of the cylinder to that of the cube is __________

      1. (a) π2\dfrac{\pi}{2}
      2. (b) 3π\dfrac{3}{\pi}
      3. (c) 9π\dfrac{9}{\pi}
      4. (d) 3π3\pi
      Show answer

      (c) 9π\dfrac{9}{\pi}

    26. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      There are five bags each containing identical sets of ten distinct chocolates. One chocolate is picked from each bag. The probability that at least two chocolates are identical is ___________

      1. (a) 0.3024
      2. (b) 0.4235
      3. (c) 0.6976
      4. (d) 0.8125
      Show answer

      (c) 0.6976

    27. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The figure below shows an annular ring with outer and inner radii as bb and aa, respectively. The annular space has been painted in the form of blue colour circles touching the outer and inner periphery of annular space. If maximum nn number of circles can be painted, then the unpainted area available in annular space is \_\_\_\_\_.

      1. (a) π[(b2−a2)−n4(b−a)2]\pi\left[(b^2-a^2)-\dfrac{n}{4}(b-a)^2\right]
      2. (b) π[(b2−a2)−n(b−a)2]\pi\left[(b^2-a^2)-n(b-a)^2\right]
      3. (c) π[(b2−a2)+n4(b−a)2]\pi\left[(b^2-a^2)+\dfrac{n}{4}(b-a)^2\right]
      4. (d) π[(b2−a2)+n(b−a)2]\pi\left[(b^2-a^2)+n(b-a)^2\right]
      Show answer

      (a) π[(b2−a2)−n4(b−a)2]\pi\left[(b^2-a^2)-\dfrac{n}{4}(b-a)^2\right]

    28. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Two straight lines are drawn perpendicular to each other in X-Y plane. If α\alpha and β\beta are the acute angles the straight lines make with the X-axis, then α+β\alpha+\beta is \_\_\_\_\_.

      1. (a) 60∘60^\circ
      2. (b) 90∘90^\circ
      3. (c) 120∘120^\circ
      4. (d) 180∘180^\circ
      Show answer

      (b) 90∘90^\circ

    29. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Ten friends planned to share equally the cost of buying a gift for their teacher. When two of them decided not to contribute, each of the other friends had to pay Rs 150 more. The cost of the gift was Rs. ____.

      1. (a) 666
      2. (b) 3000
      3. (c) 6000
      4. (d) 12000
      Show answer

      (c) 6000

  5. 20Data interpretation and statistics6 ch · 1 h 12 min6 PYQ
    1. Reading tables 12′
    2. Bar graphs and line graphs 12′
    3. Pie charts and mixed graphs 12′
    4. Data sufficiency 12′
    5. Basic statistics: mean, median, mode and range 12′
    6. Statistical analysis, graphs and diagrams for Mains 12′
    See the 6 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      For positive real numbers SS and KK, the function HK(S)H_K(S) is defined as: HK(S)=max⁡(S−K,0)H_K(S) = \max(S - K, 0). The max function is defined as:



      max⁡(a,b)={a,when a>bb,when a≤b\max(a, b) = \begin{cases} a, & \text{when } a > b \\ b, & \text{when } a \le b \end{cases}




      The graph below shows the plot of a function N(S)N(S) versus SS.

      N(S)N(S) can be expressed as _____.

      1. (a) H10(S)−H20(S)H_{10}(S) - H_{20}(S)
      2. (b) H10(S)−2H20(S)H_{10}(S) - 2H_{20}(S)
      3. (c) −H10(S)+H20(S)-H_{10}(S) + H_{20}(S)
      4. (d) H15(S)−H20(S)H_{15}(S) - H_{20}(S)
      Show answer

      (a) H10(S)−H20(S)H_{10}(S) - H_{20}(S)

    2. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Which one of the following options is correct for the given data in the table?

      | Iteration (ii) | 0 | 1 | 2 | 3 |
      |---|---|---|---|---|
      | Input (II) | 20 | −4-4 | 10 | 15 |
      | Output (XX) | 20 | 16 | 26 | 41 |
      | Output (YY) | 20 | −80-80 | −800-800 | −12000-12000 |

      1. (a) X(i)=X(i−1)+I(i);Y(i)=Y(i−1)I(i);i>0X(i) = X(i-1) + I(i);\quad Y(i) = Y(i-1)I(i);\quad i > 0
      2. (b) X(i)=X(i−1)I(i);Y(i)=Y(i−1)+I(i);i>0X(i) = X(i-1)I(i);\quad Y(i) = Y(i-1) + I(i);\quad i > 0
      3. (c) X(i)=X(i−1)I(i);Y(i)=Y(i−1)I(i);i>0X(i) = X(i-1)I(i);\quad Y(i) = Y(i-1)I(i);\quad i > 0
      4. (d) X(i)=X(i−1)+I(i);Y(i)=Y(i−1)I(i−1);i>0X(i) = X(i-1) + I(i);\quad Y(i) = Y(i-1)I(i-1);\quad i > 0
      Show answer

      (a) X(i)=X(i−1)+I(i);Y(i)=Y(i−1)I(i);i>0X(i) = X(i-1) + I(i);\quad Y(i) = Y(i-1)I(i);\quad i > 0

    3. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following sample of numbers: 9, 18, 11, 14, 15, 17, 10, 69, 11, 13 The median of the sample is

      1. (a) 13.5
      2. (b) 14
      3. (c) 11
      4. (d) 18.7
      Show answer

      (a) 13.5

    4. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The pie chart presents the percentage contribution of different macronutrients to a typical 2,000 kcal diet of a person. Macronutrient energy contribution (pie chart): Carbohydrates 35%, Proteins 20%, Unsaturated fat 20%, Saturated fat 20%, Trans fat 5%. The typical energy density (kcal/g) of these macronutrients is given in the table. | Macronutrient | Energy density (kcal/g) | |---|---| | Carbohydrates | 4 | | Proteins | 4 | | Unsaturated fat | 9 | | Saturated fat | 9 | | Trans fat | 9 | The total fat (all three types), in grams, this person consumes is

      1. (a) 44.4
      2. (b) 77.8
      3. (c) 100
      4. (d) 3,600
      Show answer

      (c) 100

    5. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      The pie charts depict the shares of various power generation technologies in the total electricity generation of a country for the years 2007 and 2023. | Source | Year 2007 | Year 2023 | |---|---|---| | Coal | 35% | 20% | | Gas | 25% | 15% | | Hydro | 30% | 35% | | Solar | 5% | 20% | | Wind | 5% | 10% | The renewable sources of electricity generation consist of Hydro, Solar and Wind. Assuming that the total electricity generated remains the same from 2007 to 2023, what is the percentage increase in the share of the renewable sources of electricity generation over this period?

      1. (a) 25%
      2. (b) 50%
      3. (c) 77.5%
      4. (d) 62.5%
      Show answer

      (d) 62.5%

    6. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The total revenue of a company during 2014-2018 is shown in the bar graph. If the total expenditure of the company in each year is 500 million rupees, then the aggregate profit or loss (in percentage) on the total expenditure of the company during 2014-2018 is \_\_\_\_.\n\n| Year | 2014 | 2015 | 2016 | 2017 | 2018 |\n|---|---|---|---|---|---|\n| Revenue (In million rupees) | 500 | 700 | 800 | 600 | 400 |

      1. (a) 16.67 % profit
      2. (b) 16.67 % loss
      3. (c) 20 % profit
      4. (d) 20 % loss
      Show answer

      (c) 20 % profit

  6. 21Verbal reasoning6 ch · 1 h 12 min8 PYQ
    1. Number and letter series 12′
    2. Coding and decoding 12′
    3. Blood relations 12′
    4. Direction sense 12′
    5. Ranking, order and comparison 12′
    6. Clocks and calendars 12′
    See the 8 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      In the 2020 summer Olympics’ Javelin throw finals, Neeraj Chopra exhibited a spectacular performance to win the gold medal. The silver medal was won by Jakub Vadlejch and the bronze medal was won by Vitezlav Vesely. There were six rounds of throws with each athlete having one throw per round. The best of all the throws of each athlete is considered for the medal. Following were the observations about the throws: i. The first and second rounds were dominated by Neeraj Chopra with a gold medal performance in his second throw, while the other two athletes did not have any medal winning throws in these rounds. ii. The throws in the last round by both Jakub Vadlejch and Vitezlav Vesely were fouls and were not considered for scoring. iii. After four rounds, Vitezlav Vesely was in the second position and could not improve upon his best throw in the succeeding rounds. iv. In the fourth round, the throw by Jakub Vadlejch was the best in that round. In which round did Vitezlav Vesely have his best throw?

      1. (a) Third
      2. (b) Fourth
      3. (c) Fifth
      4. (d) Sixth
      Show answer

      (a) Third

    2. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the relationships among P, Q, R, S, and T: - P is the brother of Q. - S is the daughter of Q. - T is the sister of S. - R is the mother of Q. The following statements are made based on the relationships given above. (1) R is the grandmother of S. (2) P is the uncle of S and T. (3) R has only one son. (4) Q has only one daughter. Which one of the following options is correct?

      1. (a) Both (1) and (2) are true.
      2. (b) Both (1) and (3) are true.
      3. (c) Only (3) is true.
      4. (d) Only (4) is true.
      Show answer

      (a) Both (1) and (2) are true.

    3. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      According to the map shown in the figure, which one of the following statements is correct? Note: The figure shown is representative.

      1. (a) The library is located to the northwest of the canteen.
      2. (b) The hospital is located to the east of the chemistry lab.
      3. (c) The chemistry lab is to the southeast of physics lab.
      4. (d) The classrooms and canteen are next to each other.
      Show answer

      (c) The chemistry lab is to the southeast of physics lab.

    4. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      If IMAGE and FIELD are coded as FHBNJ and EMFJG respectively then, which one among the given options is the most appropriate code for BEACH ?

      1. (a) CEADP
      2. (b) IDBFC
      3. (c) JGIBC
      4. (d) IBCEC
      Show answer

      (b) IDBFC

    5. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      In the sequence 6, 9, 14, xx, 30, 41, a possible value of xx is

      1. (a) 25
      2. (b) 21
      3. (c) 18
      4. (d) 20
      Show answer

      (b) 21

    6. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A series of natural numbers F1,F2,F3,F4,F5,F6,F7,…F_1, F_2, F_3, F_4, F_5, F_6, F_7, \ldots obeys Fn+1=Fn+Fn−1F_{n+1} = F_n + F_{n-1} for all integers n≥2n \ge 2.

      If F6=37F_6 = 37, and F7=60F_7 = 60, then what is F1F_1 ?

      1. (a) 4
      2. (b) 5
      3. (c) 8
      4. (d) 9
      Show answer

      (a) 4

    7. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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
      Show answer

      (c) S

    8. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      If P = 3, R = 27, T = 243, then Q + S = \_\_\_\_\_\_.

      1. (a) 40
      2. (b) 80
      3. (c) 90
      4. (d) 110
      Show answer

      (c) 90

  7. 22Puzzles and visual reasoning6 ch · 1 h 29 min22 PYQ
    1. Linear seating arrangement 18′
    2. Circular and table seating 16′
    3. Scheduling, floors and grid puzzles 16′
    4. Venn diagrams and set counting 12′
    5. Cubes and dice 14′
    6. Non-verbal reasoning: figure counting, mirror images and pattern series 13′
    See the 22 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      The figure shows two 4-tile patterns. Either one or both of the patterns can be used any number of times and in any orientation to construct a new pattern. Which one of the options below **cannot** be constructed by using only these two 4-tile patterns assuming there are no overlaps among them?

      1. (a) A 2×42 \times 4 rectangle of tiles
      2. (b) A 3×43 \times 4 rectangle of tiles
      3. (c) A 3×53 \times 5 rectangle of tiles
      4. (d) A 4×54 \times 5 rectangle of tiles
      Show answer

      (c) A 3×53 \times 5 rectangle of tiles

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      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?

      1. (a) (i)
      2. (b) (ii)
      3. (c) (iii)
      4. (d) (iv)
      Show answer

      (c) (iii)

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      In Panel I of the figure below, the front view and top view of a structure are shown. Which one of the 3D structures shown in Panel II possesses the views shown in Panel I?

      1. (a) (i)
      2. (b) (ii)
      3. (c) (iii)
      4. (d) (iv)
      Show answer

      (d) (iv)

    4. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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?

      Panel I is a 3×33 \times 3 arrangement of tiles; each tile is a 3×33 \times 3 pattern of dots, written below row by row (● black dot, ○ white dot). The two missing tiles are in the third column, second and third rows (marked ?).

      | | Column 1 | Column 2 | Column 3 |
      |---|---|---|---|
      | Row 1 | ○●● / ●●● / ●●● | ○○○ / ○○○ / ○○● | ○●● / ○●● / ○●● |
      | Row 2 | ○○● / ○○● / ○○● | ○○● / ○●● / ○●● | ? |
      | Row 3 | ○○● / ○○● / ○●● | ●●● / ●●● / ●●● | ? |

      Panel II (each option gives the upper missing tile, then the lower missing tile):

      | Option | Upper tile | Lower tile |
      |---|---|---|
      | (i) | ○●● / ○●● / ●●● | ○○○ / ○○● / ○○● |
      | (ii) | ○●● / ○●● / ○●● | ○○○ / ○○● / ○○● |
      | (iii) | ○●● / ○●● / ●●● | ○○● / ○○● / ○○● |
      | (iv) | ○●● / ○●● / ○●● | ○○● / ○○● / ○●● |

      1. (a) (i)
      2. (b) (ii)
      3. (c) (iii)
      4. (d) (iv)
      Show answer

      (a) (i)

    5. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 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? Panel I: column numbers (left to right) 2, 2, 2, 2; row numbers (top to bottom) 3, 1, 2, 2. Panel II (■ shaded, □ unshaded, rows from top to bottom): | Option | Row 1 | Row 2 | Row 3 | Row 4 | |---|---|---|---|---| | (i) | ■□■■ | □■□■ | □□■□ | ■■□□ | | (ii) | ■□■■ | □■□□ | □□■■ | ■■□□ | | (iii) | ■□■■ | □■■□ | □□■□ | ■■□□ | | (iv) | ■□■■ | □■□□ | □□■□ | ■■□■ |

      1. (a) (i)
      2. (b) (ii)
      3. (c) (iii)
      4. (d) (iv)
      Show answer

      (b) (ii)

    6. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      The paper as shown in the figure is folded to make a cube where each square corresponds to a particular face of the cube. Which one of the following options correctly represents the cube? Note: The figures shown are representative.

      1. (a) Cube showing an open triangle on the front face, a filled circle on the top face and a blank right face
      2. (b) Cube showing an open triangle on the front face, a blank top face and a filled triangle on the right face
      3. (c) Cube showing an open triangle on the front face, a blank top face and a blank right face
      4. (d) Cube showing an open triangle on the front face, a filled triangle on the top face and a filled circle on the right face
      Show answer

      (a) Cube showing an open triangle on the front face, a filled circle on the top face and a blank right face

    7. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      A square paper, shown in figure (I), is folded along the dotted lines as shown in the figures (II) and (III). Then a few cuts are made as shown in figure (IV). Which one of the following patterns will be obtained when the paper is unfolded? Note: The figures shown are representative.

      1. (a) [Figure] Unfolded square with triangular notches at the middle of all four edges (pointing inward from top and bottom edges and outward along left and right), small filled squares near the top-left and bottom-right corners, and small L-shaped cuts near the top-right and bottom-left corners.
      2. (b) [Figure] Same as the first pattern but with small diamonds (instead of squares) near the top-left and bottom-right corners.
      3. (c) [Figure] Unfolded square with filled squares near the top-left and bottom-right corners, L-shaped cuts near the top-right and bottom-left corners, triangular notches at the middle of the left and right edges, and the triangles at the top and bottom edges pointing the opposite way (top one pointing down, bottom one pointing up).
      4. (d) [Figure] Unfolded square with triangular notches at the middle of all four edges, L-shaped cuts near the top-right and bottom-left corners, and a single filled square at the centre (no corner squares).
      Show answer

      (a) [Figure] Unfolded square with triangular notches at the middle of all four edges (pointing inward from top and bottom edges and outward along left and right), small filled squares near the top-left and bottom-right corners, and small L-shaped cuts near the top-right and bottom-left corners.

    8. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      The diagram below shows a river system consisting of 7 segments, marked P, Q, R, S, T, U, and V. It splits the land into 5 zones, marked Z1, Z2, Z3, Z4, and Z5. We need to connect these zones using the least number of bridges. Out of the following options, which one is correct? Note: The figure shown is representative.

      1. (a) Bridges on P, Q, and T
      2. (b) Bridges on P, Q, S, and T
      3. (c) Bridges on Q, R, T, and V
      4. (d) Bridges on P, Q, S, U, and V
      Show answer

      (c) Bridges on Q, R, T, and V

    9. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      In an engineering college of 10,000 students, 1,500 like neither their core branches nor other branches. The number of students who like their core branches is 1/4th of the number of students who like other branches. The number of students who like both their core and other branches is 500. The number of students who like their core branches is

      1. (a) 1,800
      2. (b) 3,500
      3. (c) 1,600
      4. (d) 1,500
      Show answer

      (a) 1,800

    10. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      A cube is to be cut into 8 pieces of equal size and shape. Here, each cut should be straight and it should not stop till it reaches the other end of the cube. The minimum number of such cuts required is

      1. (a) 3
      2. (b) 4
      3. (c) 7
      4. (d) 8
      Show answer

      (a) 3

    11. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      The least number of squares to be added in the figure to make AB a line of symmetry is

      1. (a) 6
      2. (b) 4
      3. (c) 5
      4. (d) 7
      Show answer

      (a) 6

    12. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      In the 4 × 4 array shown below, each cell of the first three rows has either a cross (X) or a number. | | | | | |---|---|---|---| | 1 | X | 4 | 3 | | X | 5 | 5 | 4 | | 3 | X | 6 | X | | | | | | The number in a cell represents the count of the immediate neighboring cells (left, right, top, bottom, diagonals) NOT having a cross (X). Given that the last row has no crosses (X), the sum of the four numbers to be filled in the last row is

      1. (a) 11
      2. (b) 10
      3. (c) 12
      4. (d) 9
      Show answer

      (a) 11

    13. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which one of the options best describes the transformation of the 2-dimensional figure **P** to **Q**, and then to **R**, as shown?

      1. (a) *Operation 1*: A clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a horizontal line
      2. (b) *Operation 1*: A counter clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a horizontal line
      3. (c) *Operation 1*: A clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a vertical line
      4. (d) *Operation 1*: A counter clockwise rotation by 180º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a vertical line
      Show answer

      (a) *Operation 1*: A clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a horizontal line

    14. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      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. [Plates: A, D] 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.

      1. (a) [Plates: D, D rotated, J]
      2. (b) [Plates: R, A upside down, R rotated]
      3. (c) [Plates: Z, E rotated, D]
      4. (d) [Plates: I, L rotated, Y]
      Show answer

      (b) [Plates: R, A upside down, R rotated]

    15. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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. 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.

      1. (a) 2
      2. (b) 4
      3. (c) 5
      4. (d) 3
      Show answer

      (d) 3

    16. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      A transparent square sheet shown above is folded along the dotted line. The folded sheet will look like ________.

      1. (a) Right half of the sheet showing one curve rising from the middle of the left (fold) edge to the top-right with two short vertical ticks on it, and another curve falling from the same point to the bottom-right corner with two short horizontal dashes on it
      2. (b) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with two short vertical ticks and two short horizontal dashes inside the lens forming a stepped mark
      3. (c) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with two horizontal dashes inside the lens and no vertical ticks
      4. (d) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with a small zigzag of short strokes inside the lens
      Show answer

      (b) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with two short vertical ticks and two short horizontal dashes inside the lens forming a stepped mark

    17. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      A circular sheet of paper is folded along the lines in the directions shown. The paper, after being punched in the final folded state as shown and unfolded in the reverse order of folding, will look like _______.

      1. (a) [Figure: circle with a central circular hole, long horizontal slots above and below it, and short vertical slots to its left and right]
      2. (b) [Figure: circle with a central circular hole, long horizontal slots above and below it, and short horizontal slots to its left and right]
      3. (c) [Figure: circle with a central circular hole, short horizontal slots above and below it, and long vertical slots to its left and right]
      4. (d) [Figure: circle with a central circular hole, short vertical slots above and below it, and long vertical slots to its left and right]
      Show answer

      (a) [Figure: circle with a central circular hole, long horizontal slots above and below it, and short vertical slots to its left and right]

    18. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      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) Piece (A) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, matching the given piece's slots and teeth in sizes and positions
      2. (b) Piece (B) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, differing from (A) in the depth of the slots
      3. (c) Piece (C) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, differing from (A) in the shapes of the middle teeth
      4. (d) Piece (D) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, with a different sequence of tooth heights
      Show answer

      (a) Piece (A) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, matching the given piece's slots and teeth in sizes and positions

    19. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The police arrested four criminals – P, Q, R and S. The criminals knew each other. They made the following statements: P says “Q committed the crime.” Q says “S committed the crime.” R says “I did not do it.” S says “What Q said about me is false.” Assume only one of the arrested four committed the crime and only one of the statements made above is true. Who committed the crime?

      1. (a) P
      2. (b) R
      3. (c) S
      4. (d) Q
      Show answer

      (b) R

    20. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      In the given diagram, teachers are represented in the triangle, researchers in the circle and administrators in the rectangle. Out of the total number of the people, the percentage of administrators shall be in the range of ___________.

      1. (a) 0 to 15
      2. (b) 16 to 30
      3. (c) 31 to 45
      4. (d) 46 to 60
      Show answer

      (c) 31 to 45

    21. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      In a college, there are three student clubs. Sixty students are only in the Drama club, 80 students are only in the Dance club, 30 students are only in the Maths club, 40 students are in both Drama and Dance clubs, 12 students are in both Dance and Maths clubs, 7 students are in both Drama and Maths clubs, and 2 students are in all the clubs. If 75% of the students in the college are not in any of these clubs, then the total number of students in the college is _____.

      1. (a) 1000
      2. (b) 975
      3. (c) 900
      4. (d) 225
      Show answer

      (c) 900

    22. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Three of the five students allocated to a hostel put in special requests to the warden. Given the floor plan of the vacant rooms, select the allocation plan that will accommodate all their requests. Request by X: Due to pollen allergy, I want to avoid a wing next to the garden. Request by Y: I want to live as far from the washrooms as possible, since I am very sensitive to smell. Request by Z: I believe in Vaastu and so want to stay in the South-west wing. The shaded rooms are already occupied. WR is washroom.

      1. (a) Plan (A): Z in the North-west wing (left side); X in the South-west wing next to the washroom; Y in the South-west wing (bottom row)
      2. (b) Plan (B): X in the top-right corner room next to the garden; Z in the North-west wing (left side); Y in the South-east wing next to the garden
      3. (c) Plan (C): Z in the top-right corner room next to the garden; Y in the South-east wing next to the garden; X in the South-west wing next to the washroom
      4. (d) Plan (D): X in the South-west wing next to the washroom; Z in the South-west wing (bottom row); Y in the South-east wing below the entrance, far from both washrooms
      Show answer

      (d) Plan (D): X in the South-west wing next to the washroom; Z in the South-west wing (bottom row); Y in the South-east wing below the entrance, far from both washrooms

  8. 23Logical reasoning6 ch · 1 h 13 min6 PYQ
    1. Syllogisms 12′
    2. Statements: conclusions and assumptions 12′
    3. Arguments and courses of action 12′
    4. Cause and effect, assertion and reason 12′
    5. Logical connectives: if–then, only if, unless, either–or 12′
    6. Critical reasoning: strengthen, weaken, assumption, flaw 13′
    See the 6 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      ‘When the teacher is in the room, all students stand silently.’ If the above statement is true, which one of the following statements is not necessarily true?

      1. (a) If any student is not standing silently, then the teacher is not in the room.
      2. (b) When the teacher is in the room, all students are silent.
      3. (c) If all students are standing, then the teacher is in the room.
      4. (d) When the teacher is in the room, all students are standing.
      Show answer

      (c) If all students are standing, then the teacher is in the room.

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      'When it is raining, peacocks dance.' Based only on this sentence, which one of the following options is necessarily true?

      1. (a) Peacocks dance only when it is raining.
      2. (b) When peacocks dance, it is raining.
      3. (c) When peacocks are not dancing, it is not raining.
      4. (d) When it is not raining, peacocks do not dance.
      Show answer

      (c) When peacocks are not dancing, it is not raining.

    3. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A survey for a certain year found that 90% of pregnant women received medical care at least once before giving birth. Of these women, 60% received medical care from doctors, while 40% received medical care from other healthcare providers. Given this information, which one of the following statements can be inferred with certainty?

      1. (a) More than half of the pregnant women received medical care at least once from a doctor.
      2. (b) Less than half of the pregnant women received medical care at least once from a doctor.
      3. (c) More than half of the pregnant women received medical care at most once from a doctor.
      4. (d) Less than half of the pregnant women received medical care at most once from a doctor.
      Show answer

      (a) More than half of the pregnant women received medical care at least once from a doctor.

    4. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      The country of Zombieland is in distress since more than 75% of its working population is suffering from serious health issues. Studies conducted by competent health experts concluded that a complete lack of physical exercise among its working population was one of the leading causes of their health issues. As one of the measures to address the problem, the Government of Zombieland has decided to provide monetary incentives to those who ride bicycles to work. Based only on the information provided above, which one of the following statements can be logically inferred with certainty?

      1. (a) All the working population of Zombieland will henceforth ride bicycles to work.
      2. (b) Riding bicycles will ensure that all of the working population of Zombieland is free of health issues.
      3. (c) The health experts suggested to the Government of Zombieland to declare riding bicycles as mandatory.
      4. (d) The Government of Zombieland believes that riding bicycles is a form of physical exercise.
      Show answer

      (d) The Government of Zombieland believes that riding bicycles is a form of physical exercise.

    5. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      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.

      1. (a) Statement 1 and Statement 3
      2. (b) Statement 1 and Statement 2
      3. (c) Statement 2 and Statement 4
      4. (d) Statement 3 and Statement 4
      Show answer

      (a) Statement 1 and Statement 3

    6. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Given below are two statements 1 and 2, and two conclusions I and II. Statement 1: All bacteria are microorganisms. Statement 2: All pathogens are microorganisms. Conclusion I: Some pathogens are bacteria. Conclusion II: All pathogens are not bacteria. Based on the above statements and conclusions, which one of the following options is logically CORRECT?

      1. (a) Only conclusion I is correct
      2. (b) Only conclusion II is correct
      3. (c) Either conclusion I or II is correct.
      4. (d) Neither conclusion I nor II is correct.
      Show answer

      (c) Either conclusion I or II is correct.

  9. 24Reading comprehension1 ch · 16 min4 PYQ
    1. Inference, assumption and implication questions 16′
    See the 4 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 2 marks

      Combinatorics deals with problems involving counting. For example, “How many distinct arrangements of N distinct objects in M spaces on a circle are possible?” is a typical problem in combinatorics. This kind of counting is sometimes used in the modeling of several physical phenomena. Often, in such models, the different combinatorial possibilities are assigned probability values. Assigning probabilities enables the computation of the average values of physical quantities. Consider the following statements: P: Combinatorics is always invoked in the modeling of physical phenomena. Q: Modeling some physical phenomena involves assigning probabilities to combinatorial possibilities in order to compute average values of physical quantities. Based on the passage above, what can be inferred about statements P and Q?

      1. (a) P is False and Q is False
      2. (b) P is False and Q is True
      3. (c) P is True and Q is False
      4. (d) P is True and Q is True
      Show answer

      (b) P is False and Q is True

    2. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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?

      1. (a) Metrics are useful in organizations with poor work culture
      2. (b) Metrics are useful in organizations with good work culture
      3. (c) Metrics are always counterproductive in organizations with good work culture
      4. (d) Metrics are never useful in organizations with good work culture
      Show answer

      (b) Metrics are useful in organizations with good work culture

    3. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 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?

      1. (a) Equal number of boys and girls qualified
      2. (b) Equal number of boys and girls appeared for the test
      3. (c) The number of boys who appeared for the test is less than the number of girls who appeared
      4. (d) The number of boys who qualified the test is less than the number of girls who qualified
      Show answer

      (d) The number of boys who qualified the test is less than the number of girls who qualified

    4. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

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

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

  10. 25Decision making and interpersonal skills1 ch · 14 min1 PYQ
    1. Decision making and problem solving 14′
    See the 1 question GATE Computer Science and IT (CS) asked from this module
    1. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      There are multiple routes to reach from node 1 to node 2, as shown in the network. (Network edges with travel cost in rupees: 1→a 200, a→c 100, c→2 100, a→2 200, 1→b 300, b→2 200, b→d 0, d→e 100, e→2 200, 1→f 100, f→b 0, f→e 100.) The cost of travel on an edge between two nodes is given in rupees. Nodes 'a', 'b', 'c', 'd', 'e', and 'f' are toll booths. The toll price at toll booths marked 'a' and 'e' is Rs. 200, and is Rs. 100 for the other toll booths. Which is the cheapest route from node 1 to node 2?

      1. (a) 1-a-c-2
      2. (b) 1-f-b-2
      3. (c) 1-b-2
      4. (d) 1-f-e-2
      Show answer

      (b) 1-f-b-2

English7 modules32 ch6 h 14 min31 PYQ
  1. 26Verbs and tenses6 ch · 1 h 11 min1 PYQ
    1. Present tenses: simple, continuous, perfect and perfect continuous 12′
    2. Past tenses and 'used to / would' 13′
    3. Talking about the future; sequence of tenses 11′
    4. Subject-verb agreement 12′
    5. Modals: can, may, must, should, ought to, need and dare 12′
    6. Non-finites: infinitive, gerund and participle 11′
    See the 1 question GATE Computer Science and IT (CS) asked from this module
    1. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The expenditure on the project _____ as follows: equipment Rs.20 lakhs, salaries Rs.12 lakhs, and contingency Rs.3 lakhs.

      1. (a) break down
      2. (b) break
      3. (c) breaks down
      4. (d) breaks
      Show answer

      (c) breaks down

  2. 27Voice, speech and conditions1 ch · 12 min1 PYQ
    1. Conditionals, wishes and the subjunctive 12′
    See the 1 question GATE Computer Science and IT (CS) asked from this module
    1. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Based only on the conversation below, identify the logically correct inference: “Even if I had known that you were in the hospital, I would not have gone there to see you”, Ramya told Josephine.

      1. (a) Ramya knew that Josephine was in the hospital.
      2. (b) Ramya did not know that Josephine was in the hospital.
      3. (c) Ramya and Josephine were once close friends; but now, they are not.
      4. (d) Josephine was in the hospital due to an injury to her leg.
      Show answer

      (b) Ramya did not know that Josephine was in the hospital.

  3. 28Nouns and their partners6 ch · 1 h 12 min4 PYQ
    1. Nouns: kinds, number, countability and possession 12′
    2. Pronouns: case, agreement, reflexives and relatives 12′
    3. Articles and determiners 12′
    4. Adjectives and adverbs: degrees, order and position 12′
    5. Prepositions: time, place and fixed pairs 12′
    6. Conjunctions and linking words 12′
    See the 4 questions GATE Computer Science and IT (CS) asked from this module
    1. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Ravi had ______ younger brother who taught at ______ university. He was widely regarded as ______ honorable man. Select the option with the correct sequence of articles to fill in the blanks.

      1. (a) a; a; an
      2. (b) the; an; a
      3. (c) a; an; a
      4. (d) an; an; a
      Show answer

      (a) a; a; an

    2. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      We reached the station late, and _______ missed the train.

      1. (a) near
      2. (b) nearly
      3. (c) utterly
      4. (d) mostly
      Show answer

      (b) nearly

    3. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

      (a) as well as

    4. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Raman is confident of speaking English \_\_\_\_\_ six months as he has been practising regularly \_\_\_\_\_ the last three weeks.

      1. (a) during, for
      2. (b) for, since
      3. (c) for, in
      4. (d) within, for
      Show answer

      (d) within, for

  4. 29Error spotting and sentence improvement5 ch · 1 h 2 min1 PYQ
    1. A method for error spotting and sentence improvement 12′
    2. Error patterns: agreement and tense 12′
    3. Error patterns: pronouns, articles and prepositions 13′
    4. Error patterns: parallelism, modifiers and comparisons 13′
    5. Error patterns: redundancy, word choice and Indian English 12′
    See the 1 question GATE Computer Science and IT (CS) asked from this module
    1. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      Consider the following sentences: (i) Everybody in the class is prepared for the exam. (ii) Babu invited Danish to his home because he enjoys playing chess. Which of the following is the CORRECT observation about the above two sentences?

      1. (a) (i) is grammatically correct and (ii) is unambiguous
      2. (b) (i) is grammatically incorrect and (ii) is unambiguous
      3. (c) (i) is grammatically correct and (ii) is ambiguous
      4. (d) (i) is grammatically incorrect and (ii) is ambiguous
      Show answer

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

  5. 30Vocabulary6 ch · 1 h 7 min14 PYQ
    1. Word building: roots, prefixes and suffixes 11′
    2. Synonyms and antonyms: method, not memory 11′
    3. One-word substitution 11′
    4. Idioms and phrases 12′
    5. Phrasal verbs and collocations 11′
    6. Confusable words and spelling 11′
    See the 14 questions GATE Computer Science and IT (CS) asked from this module
    1. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1), forenoon · 1 marks

      The antonym of the word protagonist is ________.

      1. (a) agnostic
      2. (b) antagonist
      3. (c) arsonist
      4. (d) anarchist
      Show answer

      (b) antagonist

    2. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 1 marks

      Expedite, Hasten, Hurry, __________ Fill the blank by choosing a word with a meaning similar to that of the words given above.

      1. (a) Accelerate
      2. (b) Retard
      3. (c) Provide
      4. (d) Disable
      Show answer

      (a) Accelerate

    3. 2026 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2), afternoon · 2 marks

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

      1. (a) P = Thirst; Q = Hunger
      2. (b) P = Drink; Q = Hunger
      3. (c) P = Thirst; Q = Satiated
      4. (d) P = Wet; Q = Critic
      Show answer

      (a) P = Thirst; Q = Hunger

    4. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      The CEO’s decision to downsize the workforce was considered myopic because it sacrificed long-term stability to accommodate short-term gains. Select the most appropriate option that can replace the word “myopic” without changing the meaning of the sentence.

      1. (a) visionary
      2. (b) shortsighted
      3. (c) progressive
      4. (d) innovative
      Show answer

      (b) shortsighted

    5. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Bird : Nest :: Bee : _______ Select the correct option to complete the analogy.

      1. (a) Kennel
      2. (b) Hammock
      3. (c) Hive
      4. (d) Lair
      Show answer

      (c) Hive

    6. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      If ‘→’ denotes increasing order of intensity, then the meaning of the words [dry → arid → parched] is analogous to [diet → fast → ________ ]. Which one of the given options is appropriate to fill the blank?

      1. (a) starve
      2. (b) reject
      3. (c) feast
      4. (d) deny
      Show answer

      (a) starve

    7. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      If ‘→’ denotes increasing order of intensity, then the meaning of the words [walk → jog → sprint] is analogous to [bothered → ________ → daunted]. Which one of the given options is appropriate to fill the blank?

      1. (a) phased
      2. (b) phrased
      3. (c) fazed
      4. (d) fused
      Show answer

      (c) fazed

    8. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      In the given text, the blanks are numbered (i)−(iv). Select the best match for all the blanks. Steve was advised to keep his head __(i)__ before heading __(ii)__ to bat; for, while he had a head __(iii)__ batting, he could only do so with a cool head __(iv)__ his shoulders.

      1. (a) (i) down (ii) down (iii) on (iv) for
      2. (b) (i) on (ii) down (iii) for (iv) on
      3. (c) (i) down (ii) out (iii) for (iv) on
      4. (d) (i) on (ii) out (iii) on (iv) for
      Show answer

      (c) (i) down (ii) out (iii) for (iv) on

    9. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Kind : _______ : : Often : Frequently (By word meaning)

      1. (a) Mean
      2. (b) Type
      3. (c) Cruel
      4. (d) Kindly
    10. 2022 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

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

      1. (a) fair / fare
      2. (b) faer / fair
      3. (c) fare / fare
      4. (d) fare / fair
      Show answer

      (d) fare / fair

    11. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 1 marks

      _____ is to *surgery* as *writer* is to ________ Which one of the following options maintains a similar logical relation in the above sentence?

      1. (a) Plan, outline
      2. (b) Hospital, library
      3. (c) Doctor, book
      4. (d) Medicine, grammar
      Show answer

      (c) Doctor, book

    12. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      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
      Show answer

      (c) Cut

    13. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      Select the word that fits the analogy: Cook : Cook :: Fly : \_\_\_\_\_

      1. (a) Flyer
      2. (b) Flying
      3. (c) Flew
      4. (d) Flighter
      Show answer

      (a) Flyer

    14. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      A court is to a judge as ____________ is to a teacher.

      1. (a) a student
      2. (b) a punishment
      3. (c) a syllabus
      4. (d) a school
      Show answer

      (d) a school

  6. 31Sentence and paragraph skills2 ch · 23 min5 PYQ
    1. Fill in the blanks and sentence completion 12′
    2. Para jumbles and sentence ordering 11′
    See the 5 questions GATE Computer Science and IT (CS) asked from this module
    1. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 1 marks

      Despite his initial hesitation, Rehman’s _________ to contribute to the success of the project never wavered. Select the most appropriate option to complete the above sentence.

      1. (a) ambivalence
      2. (b) satisfaction
      3. (c) resolve
      4. (d) revolve
      Show answer

      (c) resolve

    2. 2024 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS2) · 2 marks

      Sequence the following sentences in a coherent passage. P: This fortuitous geological event generated a colossal amount of energy and heat that resulted in the rocks rising to an average height of 4 km across the contact zone. Q: Thus, the geophysicists tend to think of the Himalayas as an active geological event rather than as a static geological feature. R: The natural process of the cooling of this massive edifice absorbed large quantities of atmospheric carbon dioxide, altering the earth’s atmosphere and making it better suited for life. S: Many millennia ago, a breakaway chunk of bedrock from the Antarctic Plate collided with the massive Eurasian Plate.

      1. (a) QPSR
      2. (b) QSPR
      3. (c) SPRQ
      4. (d) SRPQ
      Show answer

      (c) SPRQ

    3. 2023 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Which one of the following sentence sequences creates a coherent narrative? (i) Once on the terrace, on her way to her small room in the corner, she notices the man right away. (ii) She begins to pant by the time she has climbed all the stairs. (iii) Mina has bought vegetables and rice at the market, so her bags are heavy. (iv) He was leaning against the parapet, watching the traffic below.

      1. (a) (i), (ii), (iv), (iii)
      2. (b) (ii), (iii), (i), (iv)
      3. (c) (iv), (ii), (i), (iii)
      4. (d) (iii), (ii), (i), (iv)
      Show answer

      (d) (iii), (ii), (i), (iv)

    4. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      His knowledge of the subject was excellent but his classroom performance was \_\_\_\_\_.

      1. (a) extremely poor
      2. (b) good
      3. (c) desirable
      4. (d) praiseworthy
      Show answer

      (a) extremely poor

    5. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The search engine's business model ___________ around the fulcrum of trust.

      1. (a) revolves
      2. (b) plays
      3. (c) sinks
      4. (d) bursts
      Show answer

      (a) revolves

  7. 32Reading comprehension6 ch · 1 h 7 min5 PYQ
    1. How to read serious prose: structure and the main idea 11′
    2. Main idea, title and author's purpose questions 11′
    3. Inference, assumption and implication 11′
    4. Tone, attitude and vocabulary in context 11′
    5. Option traps and timing strategy for CSAT 12′
    6. Practice passages with full solutions 11′
    See the 5 questions GATE Computer Science and IT (CS) asked from this module
    1. 2025 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      “I put the brown paper in my pocket along with the chalks, and possibly other things. I suppose every one must have reflected how primeval and how poetical are the things that one carries in one’s pocket: the pocket-knife, for instance the type of all human tools, the infant of the sword. Once I planned to write a book of poems entirely about the things in my pocket. But I found it would be too long: and the age of the great epics is past.” (From G.K. Chesterton’s “A Piece of Chalk”) Based only on the information provided in the above passage, which one of the following statements is true?

      1. (a) The author of the passage carries a mirror in his pocket to reflect upon things.
      2. (b) The author of the passage had decided to write a poem on epics.
      3. (c) The pocket-knife is described as the infant of the sword.
      4. (d) Epics are described as too inconvenient to write.
      Show answer

      (c) The pocket-knife is described as the infant of the sword.

    2. 2021 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS1) · 2 marks

      Some people suggest anti-obesity measures (AOM) such as displaying calorie information in restaurant menus. Such measures sidestep addressing the core problems that cause obesity: poverty and income inequality. Which one of the following statements summarizes the passage?

      1. (a) The proposed AOM addresses the core problems that cause obesity.
      2. (b) If obesity reduces, poverty will naturally reduce, since obesity causes poverty.
      3. (c) AOM are addressing the core problems and are likely to succeed.
      4. (d) AOM are addressing the problem superficially.
      Show answer

      (d) AOM are addressing the problem superficially.

    3. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 1 marks

      The dawn of the 21st century witnessed the melting glaciers oscillating between giving too much and too little to billions of people who depend on them for fresh water. The UN climate report estimates that without deep cuts to man-made emissions, at least 30% of the northern hemisphere's surface permafrost could melt by the end of the century. Given this situation of imminent global exodus of billions of people displaced by rising seas, nation-states need to rethink their carbon footprint for political concerns, if not for environmental ones. Which one of the following statements can be inferred from the given passage?

      1. (a) Nation-states do not have environmental concerns.
      2. (b) Nation-states are responsible for providing fresh water to billions of people.
      3. (c) Billions of people are responsible for man-made emissions.
      4. (d) Billions of people are affected by melting glaciers.
      Show answer

      (d) Billions of people are affected by melting glaciers.

    4. 2020 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      Goods and Services Tax (GST) is an indirect tax introduced in India in 2017 that is imposed on the supply of goods and services, and it subsumes all indirect taxes except few. It is a destination-based tax imposed on goods and services used, and it is not imposed at the point of origin from where goods come. GST also has a few components specific to state governments, central government and Union Territories (UTs). Which one of the following statements can be inferred from the given passage?

      1. (a) GST is imposed on the production of goods and services.
      2. (b) GST includes all indirect taxes.
      3. (c) GST does not have a component specific to UT.
      4. (d) GST is imposed at the point of usage of goods and services.
      Show answer

      (d) GST is imposed at the point of usage of goods and services.

    5. 2019 · GATE Computer Science and IT (CS) · Computer Science and Information Technology (CS) · 2 marks

      “A recent High Court judgement has sought to dispel the idea of begging as a disease — which leads to its stigmatization and criminalization — and to regard it as a symptom. The underlying disease is the failure of the state to protect citizens who fall through the social security net.” Which one of the following statements can be inferred from the given passage?

      1. (a) Beggars are lazy people who beg because they are unwilling to work
      2. (b) Beggars are created because of the lack of social welfare schemes
      3. (c) Begging is an offence that has to be dealt with firmly
      4. (d) Begging has to be banned because it adversely affects the welfare of the state
      Show answer

      (b) Beggars are created because of the lack of social welfare schemes

Official GATE Computer Science and IT (CS) syllabus

17/17 lines ready

Pick a paper. Green lines already have chapters; tap one to open them.

General Aptitude (GA, common to all papers, 15 marks)

15

Exam pattern

Negative marking: MCQs only: 1/3 mark cut for a wrong 1-mark answer and 2/3 for a wrong 2-mark answer. No negative marks for MSQ and numerical (NAT) questions.

Prelims

PaperQuestionsMarksTimeCounts for merit?
General Aptitude (common to all papers)1015—Yes
Subject paper (incl. engineering mathematics)55853 hours (whole test)Yes
Merit marks from this stage100

GATE Computer Science and IT (CS) previous year questions (PYQ)

777 GATE Computer Science and IT (CS) PYQs are already inside the study plan above, under the module each one tests. Open the study plan ↑

Topic-wise PYQs from the official question papers are being added next. Each question will sit under the syllabus line it tests, with the year and the answer explained.

GATE Computer Science and IT (CS) course: quick answers

Is this GATE Computer Science and IT (CS) course free?

Yes. Every chapter linked here is free to read in English and Hindi, with practice questions at the end.

Does this course follow the official GATE Computer Science and IT (CS) syllabus?

Yes. Each syllabus line is copied from the official notice (GATE 2026 syllabus, CS Computer Science and Information Technology (IIT Guwahati, organising institute)), and the chapters under it are mapped to that line.

How many chapters are ready for GATE Computer Science and IT (CS)?

130 chapters are mapped to the syllabus and 130 are open on the site now. 17 of 17 syllabus lines already have study material; the rest are being written.

Where are the GATE Computer Science and IT (CS) previous year questions?

777 GATE Computer Science and IT (CS) PYQs already sit inside the study plan, under the module they test, with the year and answer. More are added as the official papers are tagged.