GATE CS 2025 Set 2

65 questions · Previous year paper

The GATE 2025 Computer Science and Information Technology paper, Set 2: 65 questions for 100 marks in 180 minutes, with General Aptitude (15 marks) and the technical section (85 marks). Answers follow the official final answer key; every question has a short explanation.

Take it as a timed test: ₹99

Computer Science and Information Technology

Question 41

MCQ · 2 marks · −0.66

An array \(A\) of length \(n\) with distinct elements is said to be bitonic if there is an index \(1 \le i \le n\) such that \(A[1..i]\) is sorted in the non-decreasing order and \(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 \(A\)?

Options for Question 41

Explanation

Answer: (D)

Search in three binary-search phases:

  1. Find the peak: compare \(A[m]\) with \(A[m+1]\). If \(A[m] < A[m+1]\) the peak is to the right, otherwise at \(m\) or to its left. Each comparison halves the range: \(O(\log n)\).
  2. Binary search the increasing part \(A[1..i]\).
  3. Binary search the decreasing part \(A[i+1..n]\).

That is \(O(\log n)\) comparisons in all, and no algorithm can do better: a sorted array is itself bitonic (take \(i = n\)), and searching a sorted array needs \(\Omega(\log n)\) comparisons. So the bound is \(\Theta(\log n)\); \(\Theta(\log^{2} n)\) is achievable but not the best, and \(\Theta(1)\) is impossible.

Answer: D

Question 42

MSQ · 2 marks

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

\(\forall f, g \in \mathcal{F},\ f \preccurlyeq g\) if and only if \(\forall x \in \{1, \ldots, n\},\ f(x) \le g(x),\) where \(0 \le 1\).

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

Options for Question 42

Explanation

Answer: (B), (C)

Each \(f \in \mathcal{F}\) is an \(n\)-bit vector, and \(f \preccurlyeq g\) compares the vectors position by position.

  • Reflexive: \(f(x) \le f(x)\). Antisymmetric: \(f \preccurlyeq g\) and \(g \preccurlyeq f\) force \(f(x) = g(x)\) for every \(x\). Transitive, because \(\le\) is. So it is a partial order (B).
  • Any two functions have a greatest lower bound, the pointwise minimum, and a least upper bound, the pointwise maximum, so it is a lattice (C): the Boolean lattice of subsets of \(\{1, \ldots, n\}\).
  • It is not symmetric: the all-0 function is \(\preccurlyeq\) the all-1 function, but not the other way round. So A is false, and D is false because an equivalence relation must be symmetric.

Answer: B, C

Question 43

MSQ · 2 marks

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

Four-variable Karnaugh map with wx labelling the rows and yz labelling the columns; the individual rows and columns carry no labels. The rows read, from top to bottom: 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) \(F\)?

Options for Question 43

Explanation

Answer: (A), (D)

Read the map with the usual Gray-code order (00, 01, 11, 10) for \(wx\) and \(yz\). The four corner 1s are the cells with \(x = 0, z = 0\), and the central block of four 1s has \(x = 1, z = 1\). So \(F = \overline{x}\,\overline{z} + xz\), which is option D.

  • A: its four 4-literal terms are exactly the four corner cells, and \(\overline{x}\,\overline{z}(\overline{w}\,\overline{y} + w\overline{y} + \overline{w}y + wy) = \overline{x}\,\overline{z}\), so A equals D.
  • B: \(w\overline{x}yz\) has \(x = 0, z = 1\), a 0 cell, and two corner cells are missing.
  • C: \(w\overline{x}\,\overline{y}z\) is also a 0 cell, and two corner cells are missing.

Answer: A, D

Question 44

MSQ · 2 marks

Consider a system of linear equations \(PX = Q\) where \(P \in \mathbb{R}^{3 \times 3}\) and \(Q \in \mathbb{R}^{3 \times 1}\). Suppose \(P\) has an LU decomposition, \(P = LU\), where

\[ 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?

Options for Question 44

Explanation

Answer: (A), (B), (C)

  • A true. \(PX = Q\) is \(L(UX) = Q\). Put \(Y = UX\): solve \(LY = Q\) by forward substitution, then \(UX = Y\) by back substitution.
  • B true. \(L\) has a unit diagonal, so \(\det L = 1\) and \(\det P = \det L \cdot \det U = u_{11}u_{22}u_{33}\). If \(P\) is invertible this is non-zero, so \(U\) is invertible, and \(L\) always is.
  • C true. If \(P\) is singular, \(u_{11}u_{22}u_{33} = \det P = 0\), so some \(u_{ii} = 0\).
  • D false. A triangular matrix is symmetric only if it is diagonal. The symmetric \(P = \begin{bmatrix} 1 & 1 & 0 \\ 1 & 2 & 0 \\ 0 & 0 & 1 \end{bmatrix}\) has \(l_{21} = 1\) and \(u_{12} = 1\) with \(l_{12} = u_{21} = 0\), so neither factor is symmetric.

Answer: A, B, C

Question 45

MSQ · 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)\) 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?

Options for Question 45

Explanation

Answer: (A)

  • A works. On PUSH, the new record stores a pointer to the minimum of the records below it: the smaller of the old top and the record the old top points to, found in \(O(1)\). MIN compares the top with the record its pointer names, also \(O(1)\). POP just removes the top, and the pointers in the records left behind are still correct.
  • B fails. Once the minimum is popped, finding the new minimum needs an \(O(n)\) scan, so POP gets slower.
  • C fails. Keeping an array sorted costs \(O(n)\) shifting on each PUSH and POP.
  • D fails. Heap insertion and deletion take \(O(\log n)\), so PUSH and POP are no longer \(O(1)\).

Answer: A

Question 46

MSQ · 2 marks

Consider the following relational schema along with all the functional dependencies that hold on them.

R1(A, B, C, D, E): \(\{D \to E,\ EA \to B,\ EB \to C\}\)

R2(A, B, C, D): \(\{A \to D,\ A \to B,\ C \to A\}\)

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

Options for Question 46

Explanation

Answer: (C), (D)

A relation is in 3NF if, for every non-trivial FD \(X \to Y\), either \(X\) is a superkey or every attribute of \(Y\) is prime (part of some candidate key).

  • R1: \(A\) and \(D\) appear on no right-hand side, so every key contains both, and \(\{A, D\}^{+} = \{A, B, C, D, E\}\). The only key is \(AD\). In \(D \to E\), \(D\) is not a superkey and \(E\) is not prime, so R1 is NOT in 3NF (it is not even in 2NF).
  • R2: \(C\) appears on no right-hand side and \(C^{+} = \{A, B, C, D\}\), so \(C\) is the only key. In \(A \to D\), \(A\) is not a superkey and \(D\) is not prime: the transitive dependency \(C \to A \to D\). So R2 is NOT in 3NF.

Answer: C, D

Question 47

MSQ · 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):

initiallyafter
-1*2*3*4*5*416*451*3*2*
-1111111666662
--224444444111
---33555555533

The *-marked references cause page replacements.

Which one or more of the following could be the page replacement policy/policies in use?

Options for Question 47

Explanation

Answer: (D)

The table replaces page 2 at the 4th reference, 3 at the 5th, 1 at the 8th, and then 4, 5 and 6 at the last three.

  • Optimal fits. At the 4th reference the frames hold 1, 2, 3, next used at references 7, 13 and 12, so 2, needed farthest ahead, goes. Likewise 3 goes at the 5th reference and 1 at the 8th. At the last three faults no page in memory is used again, so any victim is optimal.
  • LRU fails: at the 4th reference it would evict 1, the least recently used page.
  • LFU fails: at the 8th reference page 5 has one use and pages 1 and 4 have two, so it would evict 5.
  • MFU fails: at the 4th reference pages 1, 2 and 3 have one use each, and a first-in or least-recently-used tie-break evicts 1, not 2.

Answer: D

Question 48

MSQ · 2 marks

\(P = \{P_1, P_2, P_3, P_4\}\) consists of all active processes in an operating system.
\(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: \(R_1 \to P_1,\ R_2 \to P_2,\ R_3 \to P_3,\ R_4 \to P_4\) (the assignment edge \(R_1 \to P_1\) means resource \(R_1\) is assigned to process \(P_1\), and so on for others)

Claim edges: \(P_1 \to R_2,\ P_2 \to R_3,\ P_3 \to R_1,\ P_2 \to R_4,\ P_4 \to R_2\) (the claim edge \(P_1 \to R_2\) means process \(P_1\) is waiting for resource \(R_2\), and so on for others)

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

Options for Question 48

Explanation

Answer: (C), (D)

Every resource has a single instance, so a cycle means deadlock. Turn each edge pair into a waits-for edge between processes: \(P_1 \to P_2\) (for \(R_2\)), \(P_2 \to P_3\) (for \(R_3\)), \(P_2 \to P_4\) (for \(R_4\)), \(P_3 \to P_1\) (for \(R_1\)) and \(P_4 \to P_2\) (for \(R_2\)). That gives two cycles, \(P_1 \to P_2 \to P_3 \to P_1\) and \(P_2 \to P_4 \to P_2\), and both pass through \(P_2\).

  • Aborting \(P_1\) leaves the cycle \(P_2 \to P_4 \to P_2\) (A false).
  • Aborting \(P_3\) leaves the same cycle (B false).
  • Aborting \(P_2\) breaks both cycles (C true).
  • Aborting \(P_1\) and \(P_4\) removes a process from each cycle; only \(P_2 \to P_3\) remains (D true).

Answer: C, D

Question 49

MSQ · 2 marks

Three floating point numbers \(X, Y\), and \(Z\) are stored in three registers RX, RY, and RZ, respectively in IEEE 754 single precision format as given below in hexadecimal:

RX = 0xC1100000, RY = 0x40C00000, and RZ = 0x41400000

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

Options for Question 49

Explanation

Answer: (A), (B), (C)

Read each word as sign (1 bit), biased exponent (8 bits) and fraction (23 bits); the value is \((-1)^{s} \times 1.f \times 2^{e - 127}\).

  • 0xC1100000: sign 1, exponent 10000010 = 130, fraction 001000…, so \(X = -1.125 \times 2^{3} = -9\).
  • 0x40C00000: sign 0, exponent 10000001 = 129, fraction 100000…, so \(Y = 1.5 \times 2^{2} = 6\).
  • 0x41400000: sign 0, exponent 10000010 = 130, fraction 100000…, so \(Z = 1.5 \times 2^{3} = 12\).

Now check each option: (A) \(4(-9 + 6) + 12 = 0\); (B) \(12 - 12 = 0\); (C) \(-36 + 36 = 0\). (D) fails because \(-9 + 6 + 12 = 9\).

Answer: A, B, C

Question 50

MSQ · 2 marks

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

Options for Question 50

Explanation

Answer: (B), (C), (D)

  • (A) is wrong. The left side is \(\sum m(0, 3, 4, 5, 7)\) over \(ABC\). On the right, \(B\,C\) gives \(m_3, m_7\), \(\overline{B}\,\overline{C}\) gives \(m_0, m_4\) and \(\overline{A}\,\overline{B}\) gives \(m_0, m_1\): it contains 001 and misses 101. With \(A\,\overline{B}\) as the last term it would hold.
  • (B) is the consensus theorem: \(BC = ABC + \overline{A}BC\), and these two terms are absorbed by \(AB\) and \(\overline{A}C\).
  • (C) Expanding gives \(A\overline{A} + AB + \overline{A}C + BC = AB + \overline{A}C + BC\), which reduces to \(AB + \overline{A}C\) by (B).
  • (D) By De Morgan, the complement of the product is the sum of the complemented factors: \(\overline{A}BD + \overline{C}\,\overline{D} + A\overline{C}\,\overline{D} + \overline{A}\,\overline{B}D\). The first and last terms combine to \(\overline{A}D\), and \(A\overline{C}\,\overline{D}\) is absorbed by \(\overline{C}\,\overline{D}\).

Answer: B, C, D

Questions 41 to 50 of 65