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 11

MCQ · 1 mark · −0.33

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

Options for Question 11

Explanation

Answer: (C)

Square the matrix first. The diagonal entries are \(1 \cdot 1 + 2 \cdot 2 = 5\) and \(2 \cdot 2 + (-1)(-1) = 5\), and both off-diagonal entries are \(1 \cdot 2 + 2 \cdot (-1) = 0\), so

\[A^{2} = \begin{pmatrix} 5 & 0 \\ 0 & 5 \end{pmatrix} = 5I.\]

Then \(A^{8} = (A^{2})^{4} = 5^{4}I = 625I\). The other options are \(5^{2}I\), \(5^{3}I\) and \(5^{5}I\), which are \(A^{4}\), \(A^{6}\) and \(A^{10}\).

Answer: C

Question 12

MCQ · 1 mark · −0.33

The value of \(x\) such that \(x \gt 1\), satisfying the equation \(\int_{1}^{x} t \ln t \, dt = \frac{1}{4}\) is

Options for Question 12

Explanation

Answer: (A)

Integrate by parts with \(u = \ln t\) and \(dv = t \, dt\):

\[\int t \ln t \, dt = \frac{t^{2}}{2}\ln t - \frac{t^{2}}{4}.\]

So \(\int_{1}^{x} t \ln t \, dt = \frac{x^{2}}{2}\ln x - \frac{x^{2}}{4} + \frac{1}{4}\). Setting this equal to \(\frac{1}{4}\) gives \(\frac{x^{2}}{2}\ln x = \frac{x^{2}}{4}\). Since \(x \neq 0\), \(\ln x = \frac{1}{2}\), so \(x = \sqrt{e}\).

The other options fail this last check: \(e\), \(e^{2}\) and \(e - 1\) give \(\ln x = 1\), \(2\) and about \(0.54\), not \(\frac{1}{2}\).

Answer: A

Question 13

MCQ · 1 mark · −0.33

Consider a binary tree \(T\) in which every node has either zero or two children. Let \(n \gt 0\) be the number of nodes in \(T\).

Which ONE of the following is the number of nodes in \(T\) that have exactly two children?

Options for Question 13

Explanation

Answer: (B)

Let \(k\) be the number of nodes with two children; all other nodes are leaves. Count the edges in two ways:

  • each of the \(k\) internal nodes has 2 child edges, giving \(2k\) edges;
  • every node except the root has exactly one edge to its parent, giving \(n - 1\) edges.

So \(2k = n - 1\), that is, \(k = \frac{n-1}{2}\). For example, a root with two leaf children has \(n = 3\) and \(k = 1\). Such a tree always has an odd number of nodes, so \(\frac{n}{2}\) and \(\frac{n-2}{2}\) are not even whole numbers, while \(\frac{n+1}{2}\) counts the leaves.

Answer: B

Question 14

MCQ · 1 mark · −0.33

Let \(L, M\), and \(N\) be non-singular matrices of order 3 satisfying the equations

\(L^{2} = L^{-1}\) , \(M = L^{8}\) and \(N = L^{2}\).

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

Options for Question 14

Explanation

Answer: (A)

Multiply \(L^{2} = L^{-1}\) on the right by \(L\) to get \(L^{3} = I\). Powers of \(L\) therefore repeat every three steps:

\[M = L^{8} = (L^{3})^{2}L^{2} = L^{2} = N.\]

So \(M - N\) is the zero matrix, and its determinant is 0. Non-singularity only guarantees that \(L^{-1}\) exists; it says nothing about the difference \(M - N\), so the non-zero options cannot occur.

Answer: A

Question 15

MCQ · 1 mark · −0.33

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

Which ONE of the following statements is TRUE?

Options for Question 15

Explanation

Answer: (A)

Option A is the principle of mathematical induction: \(P(0)\) holds, and truth passes from each \(x\) to \(x + 1\), so it reaches 1, 2, 3, … and hence every natural number. It is true for every predicate \(P\).

Each other option fails for some predicate:

  • B: take \(P(x)\) to be “\(x \le 5\)”. Both premises hold, but \(P(6)\) is false.
  • C: take “\(x \le 1000\)”. Both premises hold, but \(P(1001)\) is false.
  • D: take “\(x \ge 1000\)”. Both premises hold, but \(P(0)\) is false.

Answer: A

Question 16

MCQ · 1 mark · −0.33

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?

Options for Question 16

Explanation

Answer: (B)

(i) is TRUE. A host that knows the IP address of a machine on its local network still needs that machine’s link-layer (MAC) address to build a frame. ARP broadcasts a request for that IP address and gets back the matching hardware address.

(ii) is FALSE. TCP is full duplex, and every segment header has an acknowledgement number field, so a segment carrying data from S to R can also acknowledge data received from R. This is called piggybacking, and it is the normal case when both sides are sending.

Answer: B

Question 17

MCQ · 1 mark · −0.33

Consider the routing protocols given in List I and the names given in List II:

List IList 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?

Options for Question 17

Explanation

Answer: (A)

In distance vector routing (used by RIP), a router learns only the distance vectors of its neighbours. It keeps improving its own estimates with the Bellman-Ford relation \(D_x(y) = \min_v \{c(x, v) + D_v(y)\}\): the cost to a neighbour \(v\) plus that neighbour's distance to \(y\). So (i) matches (a).

In link state routing (used by OSPF), every router floods the costs of its own links, so each router learns the whole topology and runs Dijkstra's shortest path algorithm from itself. So (ii) matches (b).

The other options pair at least one protocol family with the wrong algorithm.

Answer: A

Question 18

MCQ · 1 mark · −0.33

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?

Options for Question 18

Explanation

Answer: (D)

The protocol field names the protocol whose message sits directly in the payload of the IP datagram, so X must be a protocol that runs immediately on top of IP.

  • ICMP (protocol number 1) and IGMP (2) are carried directly in IP datagrams.
  • OSPF also runs directly over IP, with protocol number 89.
  • RIP does not. Its messages travel inside UDP datagrams on port 520, so a datagram carrying RIP has 17 (UDP) in its protocol field, and RIP is identified only by the UDP port.

So RIP cannot be X.

Answer: D

Question 19

MCQ · 1 mark · −0.33

Consider the following C program:

#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?

Options for Question 19

Explanation

Answer: (D)

The array holds the 14 characters @#Hello World! at indices 0 to 13, followed by '\0' at index 14.

stringcopy(a, a + 2) copies one character at a time from t to s, with t always two places ahead of s. Every character is therefore read before it can be overwritten, and the 12 characters Hello World! land in indices 0 to 11.

The loop stops as soon as *t is '\0', so the terminator is never copied. Indices 12 and 13 keep their old characters d!, and the string still ends at index 14, so printf prints Hello World!d!.

Answer: D

Question 20

MCQ · 1 mark · −0.33

Consider an unordered list of \(N\) 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?

Options for Question 20

Explanation

Answer: (A)

Pick any two elements and compare them once. Because the integers are distinct, one of them is strictly smaller, and that smaller element cannot be the largest in the list: the other element beats it. So one comparison always suffices.

Zero comparisons cannot work, since without any comparison every element we might pick could still be the maximum. Hence the minimum is 1.

\(N - 1\) comparisons are what it takes to find the largest element itself, which is a different task; the question only asks for some element that is not the largest.

Answer: A

Questions 11 to 20 of 65