GATE CS 2024 Set 2

65 questions · Previous year paper

The GATE 2024 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 51

MSQ · 2 marks

Let \(G\) be an undirected connected graph in which every edge has a positive integer weight. Suppose that every spanning tree in \(G\) has even weight. Which of the following statements is/are TRUE for every such graph \(G\) ?

Options for Question 51

Explanation

Answer: (D)

(D) holds. Suppose a cycle \(C\) has an even edge \(e\) and an odd edge \(f\). Extend the path \(C - f\) to a spanning tree \(T\); it contains \(e\) but not \(f\). Removing \(e\) splits \(T\) into two parts, and \(f\) must join them, because the rest of the cycle links the ends of \(e\). So \(T - e + f\) is another spanning tree whose weight differs from that of \(T\) by an odd amount, and both cannot be even.

The others fail. A triangle with weights 1, 1, 1 has every spanning tree of weight 2, yet its edges are odd, which rules out (A) and (C). A path with weights 1, 1, 2 is its own only spanning tree (weight 4) and mixes parities, which rules out (B).

Answer: D

Question 52

MSQ · 2 marks

Consider a context-free grammar \(G\) with the following 3 rules.

\(S \rightarrow aS,\ S \rightarrow aSbS,\ S \rightarrow c\)

Let \(w \in L(G)\). Let \(n_a(w),\ n_b(w),\ n_c(w)\) denote the number of times \(a, b, c\) occur in \(w\), respectively. Which of the following statements is/are TRUE?

Options for Question 52

Explanation

Answer: (B), (C)

Follow the counts through a derivation, which starts with one \(S\). The rule \(S \rightarrow aSbS\) adds one \(a\), one \(b\) and one extra \(S\); \(S \rightarrow aS\) adds one \(a\); \(S \rightarrow c\) turns one \(S\) into \(c\). Every \(S\) must finally become a \(c\), so:

  • \(n_c(w) = 1 + n_b(w)\), so (C) is true.
  • Every \(b\) arrives with an \(a\), so \(n_a(w) \ge n_b(w) = n_c(w) - 1 \gt n_c(w) - 2\), and (B) is true.

The string \(w = c\) has \(n_a = n_b = 0\) and \(n_c = 1\). It breaks (A), since \(0 \gt 0\) is false, and (D), since \(1 \ne 0\).

Answer: B, C

Question 53

NAT · 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 _________

Explanation

Answer: 29.5 to 30.5

At 6000 RPM the disk makes 100 rotations per second, so one rotation takes 10 ms.

  • Seek time: 5 ms.
  • Average rotational latency: half a rotation, 5 ms.
  • Transfer time of one sector: \(10 / 500 = 0.02\) ms.

Because the sectors lie at random places, each one needs its own seek and rotational wait: \(5 + 5 + 0.02 = 10.02\) ms per sector. For 3000 sectors the total is \(3000 \times 10.02 = 30060\) ms, that is 30.06 s. The sector size (512 bytes) is not needed. Treating the file as stored on consecutive sectors would give a much smaller time.

Answer: 30.06

Question 54

NAT · 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 _________

Explanation

Answer: 4

On a timeout, TCP sets the slow-start threshold to half the current window, \(12 / 2 = 6\) MSS, and restarts slow start from a window of 1 MSS. In slow start the window doubles every RTT while all segments are acknowledged:

  • first RTT after the timeout: 1 MSS;
  • second RTT: 2 MSS;
  • third RTT: 4 MSS.

The window is still below the threshold of 6, so slow start has not yet given way to linear growth. Continuing from 6 MSS would be the fast-recovery response to triple duplicate ACKs, not to a timeout.

Answer: 4

Question 55

NAT · 2 marks

Consider an Ethernet segment with a transmission speed of \(10^{8}\) bits/sec and a maximum segment length of 500 meters. If the speed of propagation of the signal in the medium is \(2 \times 10^{8}\) meters/sec, then the minimum frame size (in bits) required for collision detection is _________

Explanation

Answer: 500

With CSMA/CD a station detects a collision only while it is still transmitting. In the worst case the collision happens at the far end of the segment, and the noise needs another one-way delay to come back, so a frame must last at least one round-trip propagation time.

  • One-way delay: \(500 / (2 \times 10^{8}) = 2.5\ \mu\text{s}\).
  • Round trip: \(5\ \mu\text{s}\).
  • Minimum frame size: \(10^{8} \times 5 \times 10^{-6} = 500\) bits.

Using the one-way delay alone would give 250 bits, too short to guarantee detection.

Answer: 500

Question 56

NAT · 2 marks

A functional dependency \(F\colon X \rightarrow Y\) is termed as a useful functional dependency if and only if it satisfies all the following three conditions:

  • \(X\) is not the empty set.
  • \(Y\) is not the empty set.
  • Intersection of \(X\) and \(Y\) is the empty set.

For a relation \(R\) with 4 attributes, the total number of possible useful functional dependencies is ________

Explanation

Answer: 50

Since \(X\) and \(Y\) must be disjoint, a dependency is fixed by giving each of the 4 attributes one of three roles: in \(X\), in \(Y\), or in neither. That gives \(3^{4} = 81\) assignments. Remove those with an empty side by inclusion–exclusion:

  • \(X\) empty: each attribute is in \(Y\) or in neither, \(2^{4} = 16\) ways;
  • \(Y\) empty: likewise 16 ways;
  • both empty: 1 way, subtracted twice above, so add it back.

Useful dependencies: \(81 - 16 - 16 + 1 = 50\).

Answer: 50

Question 57

NAT · 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 _________

Explanation

Answer: 32

Add up the fixed fields of the 32-bit instruction:

  • each register field names one of 16 registers, so it needs \(\log_2 16 = 4\) bits, and the two fields take 8 bits;
  • 8 addressing modes need \(\log_2 8 = 3\) bits;
  • the scalar field takes 16 bits.

That leaves \(32 - 8 - 3 - 16 = 5\) bits for the opcode, so at most \(2^{5} = 32\) opcodes can be encoded. The mode has its own field, so all 32 opcodes can be combined with each of the 8 addressing modes.

Answer: 32

Question 58

NAT · 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 _________

Explanation

Answer: 2.9 to 3.1

Both designs run at the same 2 GHz clock, so the speedup is the ratio of their cycles per instruction (CPI).

  • Non-pipelined CPI: 6.
  • Pipelined CPI: the ideal 1 plus the average stall cycles, \(1 + 0.2 \times 2 + 0.2 \times 3 = 1 + 0.4 + 0.6 = 2\).

Speedup \(= 6 / 2 = 3.0\). The number of stages does not enter the calculation, because the pipelined throughput (1 instruction per cycle) and the non-pipelined cycle count (6) are both given directly.

Answer: 3.0

Question 59

NAT · 2 marks

The number of distinct minimum-weight spanning trees of the following graph is _________

Weighted undirected graph on seven vertices: g in the middle, b and c above it, f and e below it, a on the left and d on the right. Edge weights: a–b 1, a–f 1, c–d 1, d–e 1, b–c 3, f–e 3, and g is joined to each of a, b, c, d, e and f by an edge of weight 2.

Explanation

Answer: 9

Think of Kruskal’s algorithm, which takes the cheapest edges first.

  • The four weight-1 edges \(ab, af, cd, de\) form no cycle, so every minimum spanning tree contains them. They leave three components: \(\{a, b, f\}\), \(\{c, d, e\}\) and \(\{g\}\).
  • Two more edges are needed, and all weight-2 edges meet \(g\): \(ga, gb, gf\) reach the first component and \(gc, gd, ge\) the second. A tree takes exactly one from each group, since two from the same group would close a cycle.
  • The weight-3 edges are never used.

So there are \(3 \times 3 = 9\) minimum spanning trees, each of weight 8.

Answer: 9

Question 60

NAT · 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 _________

Eight dots at the corners of an octagon (two along the top, two on the left side, two on the right side and two along the bottom), joined by the octagon’s eight sides. Eight more edges join each top dot to the bottom dot directly below it, each left-side dot to the right-side dot level with it, the top-left dot to the lower right-side dot, the top-right dot to the lower left-side dot, the upper left-side dot to the bottom-right dot, and the upper right-side dot to the bottom-left dot.

Explanation

Answer: 2

Any graph with an edge needs at least 2 colours, and exactly 2 suffice when the graph is bipartite. Go round the octagon and colour the corners alternately red and blue; the eight sides are properly coloured because 8 is even.

Every other edge (the two verticals, the two horizontals and the four long diagonals) joins two corners that are three steps apart around the octagon. Three is odd, so each of them joins a red corner to a blue corner.

No edge joins two corners of the same colour, so the graph is bipartite (it is in fact \(K_{4,4}\)) and its chromatic number is 2.

Answer: 2

Questions 51 to 60 of 65