GATE 2024 CS (Set 2)

All 65 questions of GATE 2024 CS (Set 2)

Question text and figures as in the official paper, with the answer from the official key. Worked solutions for every question are in your report after you take the paper as a 3-hour test.

Q1 · General Aptitude · MCQ · 1 mark

If ‘→\to’ denotes increasing order of intensity, then the meaning of the words

[walk→jog→sprint][\text{walk} \to \text{jog} \to \text{sprint}]

is analogous to

[bothered→‾→daunted].[\text{bothered} \to \underline{\hspace{1.5cm}} \to \text{daunted}].

Which one of the given options is appropriate to fill the blank?

  • (A)
    phased
  • (B)
    phrased
  • (C)
    fazed
  • (D)
    fused

Answer (official key): C

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

Q2 · General Aptitude · MCQ · 1 mark

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 combinations of elements, they conclude that the spell does not work.

How many attempts does each wizard make before coming to this conclusion, independently?

  • (A)
    24
  • (B)
    48
  • (C)
    16
  • (D)
    12

Answer (official key): A

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

Q3 · General Aptitude · MCQ · 1 mark

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 14\frac{1}{4}th 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

  • (A)
    1,800
  • (B)
    3,500
  • (C)
    1,600
  • (D)
    1,500

Answer (official key): A

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

Q4 · General Aptitude · MCQ · 1 mark

In the sequence

6, 9, 14, x, 30, 41,6,\ 9,\ 14,\ x,\ 30,\ 41,

a possible value of xx is

  • (A)
    25
  • (B)
    21
  • (C)
    18
  • (D)
    20

Answer (official key): B

Read the worked solution

Q5 · General Aptitude · MCQ · 1 mark

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\frac{x}{y}+\frac{y}{x}

is

  • (A)
    1
  • (B)
    12\frac{1}{2}
  • (C)
    2
  • (D)
    4

Answer (official key): C

Read the worked solution

Q6 · General Aptitude · MCQ · 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.

  • (A)
    QPSR
  • (B)
    QSPR
  • (C)
    SPRQ
  • (D)
    SRPQ

Answer (official key): C

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

Q7 · General Aptitude · MCQ · 2 marks

In the 4×44 \times 4 array shown below, each cell of the first three rows has either a cross (X) or a number.

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

1X43
X554
3X6X
  • (A)
    11
  • (B)
    10
  • (C)
    12
  • (D)
    9

Answer (official key): A

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

Q8 · General Aptitude · MCQ · 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

  • (A)
    1% profit
  • (B)
    2% profit
  • (C)
    1% loss
  • (D)
    2% loss

Answer (official key): C

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

Q9 · General Aptitude · MCQ · 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

  • (A)
    3
  • (B)
    4
  • (C)
    7
  • (D)
    8

Answer (official key): A

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

Q10 · General Aptitude · MCQ · 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.

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?

Power generation shares in 2007 and 2023

  • (A)
    25%
  • (B)
    50%
  • (C)
    77.5%
  • (D)
    62.5%

Answer (official key): D

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

Q11 · Programming and Data Structures · MCQ · 1 mark

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?

  • (A)
    20101020
  • (B)
    10202010
  • (C)
    20102010
  • (D)
    10201020

Answer (official key): A

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

Q12 · Discrete Mathematics · MCQ · 1 mark

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?

  • (A)
    GG is a cycle
  • (B)
    GG is a perfect matching
  • (C)
    GG is a complete graph
  • (D)
    There is no such graph GG

Answer (official key): B

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

Q13 · Databases · MCQ · 1 mark

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

  • (A)
    durability
  • (B)
    atomicity
  • (C)
    consistency
  • (D)
    isolation

Answer (official key): A

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

Q14 · Discrete Mathematics · MCQ · 1 mark

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?

  • (A)
    q→¬pq \to \neg p
  • (B)
    q→pq \to p
  • (C)
    p→qp \to q
  • (D)
    ¬p→q\neg p \to q

Answer (official key): A

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

Q15 · Digital Logic · MCQ · 1 mark

The format of a single-precision floating-point number as per the IEEE 754 standard is:

Sign (1 bit), Exponent (8 bits), Mantissa (23 bits)

Choose the largest floating-point number among the following options.

  • (A)
    Sign = 0, Exponent = 01111111, Mantissa = 11111111111111111111111
  • (B)
    Sign = 0, Exponent = 11111110, Mantissa = 11111111111111111111111
  • (C)
    Sign = 0, Exponent = 11111111, Mantissa = 11111111111111111111111
  • (D)
    Sign = 0, Exponent = 01111111, Mantissa = 00000000000000000000000

Answer (official key): B

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

Q16 · Discrete Mathematics · MCQ · 1 mark

Let T(n)T(n) be the recurrence relation defined as follows:

T(0)=1,T(1)=2,T(0) = 1,\qquad T(1) = 2,

and

T(n)=5T(n−1)−6T(n−2)for n≥2.T(n) = 5T(n-1) - 6T(n-2) \quad \text{for } n \ge 2.

Which one of the following statements is TRUE?

  • (A)
    T(n)=Θ(2n)T(n) = \Theta(2^n)
  • (B)
    T(n)=Θ(n2n)T(n) = \Theta(n2^n)
  • (C)
    T(n)=Θ(3n)T(n) = \Theta(3^n)
  • (D)
    T(n)=Θ(n3n)T(n) = \Theta(n3^n)

Answer (official key): A

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

Q17 · Probability and Statistics · MCQ · 1 mark

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

  • (A)
    1324\frac{1}{324}
  • (B)
    5324\frac{5}{324}
  • (C)
    7324\frac{7}{324}
  • (D)
    11324\frac{11}{324}

Answer (official key): B

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

Q18 · Computer Organization and Architecture · MCQ · 1 mark

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?

  • (A)
    2,56,000
  • (B)
    3,200
  • (C)
    25,60,000
  • (D)
    32,000

Answer (official key): C

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

Q19 · Calculus · MCQ · 1 mark

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 \ ?
  • (A)
    0
  • (B)
    1
  • (C)
    2
  • (D)
    -1

Answer (official key): B

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

Q20 · Databases · MCQ · 1 mark

In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one of the following statements is TRUE?

  • (A)
    The weak entity set MUST have total participation in the identifying relationship
  • (B)
    The owner entity set MUST have total participation in the identifying relationship
  • (C)
    Both weak and owner entity sets MUST have total participation in the identifying relationship
  • (D)
    Neither weak entity set nor owner entity set MUST have total participation in the identifying relationship

Answer (official key): A

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

Q21 · Databases · MSQ · 1 mark

Which of the following file organizations is/are I/O efficient for the scan operation in DBMS?

  • (A)
    Sorted
  • (B)
    Heap
  • (C)
    Unclustered tree index
  • (D)
    Unclustered hash index

Answer (official key): A, B

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

Q22 · Databases · MSQ · 1 mark

Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?

  • (A)
    2PL permits only serializable schedules
  • (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
  • (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
  • (D)
    A deadlock is possible with 2PL

Answer (official key): A, C, D

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

Q23 · Compiler Design · MSQ · 1 mark

Which of the following statements is/are FALSE?

  • (A)
    An attribute grammar is a syntax-directed definition (SDD) in which the functions in the semantic rules have no side effects
  • (B)
    The attributes in a L-attributed definition cannot always be evaluated in a depth-first order
  • (C)
    Synthesized attributes can be evaluated by a bottom-up parser as the input is parsed
  • (D)
    All L-attributed definitions based on LR(1) grammar can be evaluated using a bottom-up parsing strategy

Answer (official key): B, D

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

Q24 · Operating System · MSQ · 1 mark

Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?

  • (A)
    Allocate a new page table for a newly created process
  • (B)
    Translate a virtual address to a physical address using the page table
  • (C)
    Raise a trap when a virtual address is not found in the page table
  • (D)
    Raise a trap when a process tries to write to a page marked with read-only permission in the page table

Answer (official key): B, C, D

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

Q25 · Computer Networks · MSQ · 1 mark

Which of the following statements about IPv4 fragmentation is/are TRUE?

  • (A)
    The fragmentation of an IP datagram is performed only at the source of the datagram
  • (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
  • (C)
    The reassembly of fragments is performed only at the destination of the datagram
  • (D)
    The reassembly of fragments is performed at all intermediate routers along the path from the source to the destination

Answer (official key): B, C

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

Q26 · Compiler Design · MCQ · 1 mark

Consider the following two sets:

Set XSet Y
P. Lexical Analyzer1. Abstract Syntax Tree
Q. Syntax Analyzer2. Token
R. Intermediate Code Generator3. Parse Tree
S. Code Optimizer4. Constant Folding

Which one of the following options is the CORRECT match from Set X to Set Y?

  • (A)
    P – 4; Q – 1; R – 3; S – 2
  • (B)
    P – 2; Q – 3; R – 1; S – 4
  • (C)
    P – 2; Q – 1; R – 3; S – 4
  • (D)
    P – 4; Q – 3; R – 2; S – 1

Answer (official key): B

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

Q27 · Digital Logic · MSQ · 1 mark

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

  • (A)
    x⋅1=xx \cdot 1 = x
  • (B)
    x+1=xx + 1 = x
  • (C)
    x⋅x=0x \cdot x = 0
  • (D)
    x+xˉ=1x + \bar{x} = 1

Answer (official key): B, C

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

Q28 · Operating System · MSQ · 1 mark

Consider a process PP 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 PP moving to a non-running state (e.g., ready, blocked)?

  • (A)
    PP makes a blocking system call to read a block of data from the disk
  • (B)
    PP tries to access a page that is in the swap space, triggering a page fault
  • (C)
    An interrupt is raised by the disk to deliver data requested by some other process
  • (D)
    A timer interrupt is raised by the hardware

Answer (official key): A, B

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

Q29 · Computer Networks · MSQ · 1 mark

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?

  • (A)
    The destination IP address is the IP address of R
  • (B)
    The destination IP address is the IP address of Y
  • (C)
    The destination MAC address is the MAC address of S
  • (D)
    The destination MAC address is the MAC address of Y

Answer (official key): B

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

Q30 · Theory of Computation · MCQ · 1 mark

Which one of the following regular expressions is equivalent to the language accepted by the DFA given below?

DFA for Q22

  • (A)
    0∗1(0+10∗1)∗0^*1(0 + 10^*1)^*
  • (B)
    0∗(10∗11)∗0∗0^*(10^*11)^*0^*
  • (C)
    0∗1(010∗1)∗0∗0^*1(010^*1)^*0^*
  • (D)
    0(1+0∗10∗1)∗0∗0(1 + 0^*10^*1)^*0^*

Answer (official key): A

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

Q31 · Computer Networks · MSQ · 1 mark

Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?

  • (A)
    Source IP Address
  • (B)
    Protocol
  • (C)
    Time to Live (TTL)
  • (D)
    Header Checksum

Answer (official key): C, D

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

Q32 · Computer Organization and Architecture · MSQ · 1 mark

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?

  • (A)
    There is a RAW dependency on R3 between I1 and I2
  • (B)
    There is a WAR dependency on R3 between I1 and I3
  • (C)
    There is a RAW dependency on R3 between I2 and I3
  • (D)
    There is a WAW dependency on R3 between I3 and I4

Answer (official key): A

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

Q33 · Discrete Mathematics · Numerical · 1 mark

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 __________.
(Answer in integer)

Answer (official key): 5

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

Q34 · Algorithms · Numerical · 1 mark

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][2, 5, 3, 1, 4, 2, 6]

is ___________.
(Answer in integer)

Answer (official key): 3

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

Q35 · Programming and Data Structures · MSQ · 1 mark

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?

  • (A)
    The function call fX("abcd") will always return a value
  • (B)
    Assuming a character array c is declared as char c[] = "abcd" in main(), the function call fX(c) will always return a value
  • (C)
    The code of the function will not compile
  • (D)
    Assuming a character pointer c is declared as char *c = "abcd" in main(), the function call fX(c) will always return a value

Answer (official key): A, B, D

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

Q36 · Programming and Data Structures · MCQ · 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?

  • (A)
    Inorder traversal of TT can be determined from VV
  • (B)
    Root node of TT can be determined from VV
  • (C)
    Preorder traversal of TT can be determined from VV
  • (D)
    Postorder traversal of TT can be determined from VV

Answer (official key): A

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

Q37 · Computer Networks · MCQ · 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 ?10.12.2.0 \text{ to } 10.12.3.255 \ ?
  • (A)
    10.12.2.0/23
  • (B)
    10.12.2.0/24
  • (C)
    10.12.0.0/22
  • (D)
    10.12.2.0/22

Answer (official key): A

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

Q38 · Operating System · MCQ · 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)(0, 10), B (2,6)(2, 6), C (4,3)(4, 3), and D (6,7)(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?

  • (A)
    SRTF = 6, NP-SJF = 7
  • (B)
    SRTF = 6, NP-SJF = 7.5
  • (C)
    SRTF = 7, NP-SJF = 7.5
  • (D)
    SRTF = 7, NP-SJF = 8.5

Answer (official key): B

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

Q39 · Programming and Data Structures · MCQ · 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;
}
  • (A)
    4,8
  • (B)
    1,5
  • (C)
    8,5
  • (D)
    1,8

Answer (official key): B

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

Q40 · Compiler Design · MCQ · 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.

LL(1) parsing table for Q40

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.

  • (A)
    (1) S→AaAbS \to AaAb (2) S→BbBaS \to BbBa (3) A→ϵA \to \epsilon (4) B→ϵB \to \epsilon
  • (B)
    (1) S→BbBaS \to BbBa (2) S→AaAbS \to AaAb (3) A→ϵA \to \epsilon (4) B→ϵB \to \epsilon
  • (C)
    (1) S→AaAbS \to AaAb (2) S→BbBaS \to BbBa (3) blank (4) blank
  • (D)
    (1) S→BbBaS \to BbBa (2) S→AaAbS \to AaAb (3) blank (4) blank

Answer (official key): A

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

Q41 · Linear Algebra · MSQ · 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?

  • (A)
    The determinant of BB is the negative of the determinant of AA
  • (B)
    If AA is invertible, then BB is also invertible
  • (C)
    If AA is symmetric, then BB is also symmetric
  • (D)
    If the trace of AA is zero, then the trace of BB is also zero

Answer (official key): A, B

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

Q42 · Digital Logic · MSQ · 2 marks

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

  • (A)
    6464 in radix-10
  • (B)
    100100 in radix-8
  • (C)
    5050 in radix-16
  • (D)
    121121 in radix-7

Answer (official key): A, B, D

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

Q43 · Probability and Statistics · MCQ · 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 xx, yy, zz be xˉ\bar{x}, yˉ\bar{y}, zˉ\bar{z}, respectively.

Which one of the following statements is TRUE?

  • (A)
    zˉ=xˉyˉ\bar{z} = \bar{x}\bar{y}
  • (B)
    zˉ≤xˉyˉ\bar{z} \le \bar{x}\bar{y}
  • (C)
    zˉ≥xˉyˉ\bar{z} \ge \bar{x}\bar{y}
  • (D)
    zˉ≤xˉ\bar{z} \le \bar{x}

Answer (official key): D

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

Q44 · Digital Logic · MSQ · 2 marks

Consider 4-variable functions f1,f2,f3,f4f_1, f_2, f_3, f_4 expressed in sum-of-minterms form as given below.

f1=∑(0,2,3,5,7,8,11,13)f_1 = \sum(0,2,3,5,7,8,11,13) f2=∑(1,3,5,7,11,13,15)f_2 = \sum(1,3,5,7,11,13,15) f3=∑(0,1,4,11)f_3 = \sum(0,1,4,11) f4=∑(0,2,6,13)f_4 = \sum(0,2,6,13)

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

Circuit for Q50

  • (A)
    Y=∑(0,1,2,11,13)\mathcal{Y} = \sum(0,1,2,11,13)
  • (B)
    Y=Π(3,4,5,6,7,8,9,10,12,14,15)\mathcal{Y} = \Pi(3,4,5,6,7,8,9,10,12,14,15)
  • (C)
    Y=∑(0,1,2,3,4,5,6,7)\mathcal{Y} = \sum(0,1,2,3,4,5,6,7)
  • (D)
    Y=Π(8,9,10,11,12,13,14,15)\mathcal{Y} = \Pi(8,9,10,11,12,13,14,15)

Answer (official key): C, D

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

Q45 · Programming and Data Structures · MSQ · 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.

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?

  • (A)
    100, 200, 400, 300
  • (B)
    200, 300, 400, 100
  • (C)
    400, 200, 100, 300
  • (D)
    300, 200, 400, 100

Answer (official key): B, C, D

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

Q46 · Theory of Computation · MCQ · 2 marks

Let MM be the 5-state NFA with ϵ\epsilon-transitions shown in the diagram below.

Which one of the following regular expressions represents the language accepted by MM?

NFA for Q41

  • (A)
    (00)∗+1(11)∗(00)^* + 1(11)^*
  • (B)
    0∗+(1+0(00)∗)(11)∗0^* + (1 + 0(00)^*)(11)^*
  • (C)
    (00)∗+(1+(00)∗)(11)∗(00)^* + (1 + (00)^*)(11)^*
  • (D)
    0++1(11)∗+0(11)∗0^+ + 1(11)^* + 0(11)^*

Answer (official key): B

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

Q47 · Compiler Design · MCQ · 2 marks

Consider the following expression:

x[i]=(p+r)∗−s[i]+u/w.x[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).

(0) +      p    r
(1)
(2) uminus (1)
(3)
(4) /      u    w
(5) +      (3)  (4)
(6)
(7) =      (6)  (5)

Which one of the following options fills in the missing entries CORRECTLY?

  • (A)
    (1) =[] s i (3) * (0) (2) (6) []= x i
  • (B)
    (1) []= s i (3) - (0) (2) (6) =[] x (5)
  • (C)
    (1) =[] s i (3) * (0) (2) (6) []= x (5)
  • (D)
    (1) []= s i (3) - (0) (2) (6) =[] x i

Answer (official key): A

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

Q48 · Algorithms · MCQ · 2 marks

Consider an array XX that contains nn positive integers. A subarray of XX 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 XX 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 ii-th iteration, the value of len1 is the length of the longest subarray ending with X[i]X[i] that contains all equal values, and len2 is the length of the longest subarray ending with X[i]X[i] that contains at most two distinct values.)

  • (A)
    (P)(P) len1+1 (Q)(Q) len2+1
  • (B)
    (P)(P) 1 (Q)(Q) len1+1
  • (C)
    (P)(P) 1 (Q)(Q) len2+1
  • (D)
    (P)(P) len2+1 (Q)(Q) len1+1

Answer (official key): B

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

Q49 · Databases · MCQ · 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

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

Answer (official key): B

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

Q50 · Operating System · MSQ · 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
wait(s1);
x = x+1;
print(x);
wait(s2);
signal(s1);

// code of T2
wait(s1);
x = x+1;
print(x);
signal(s2);
signal(s1);

Which of the following outcomes is/are possible when threads T1 and T2 execute concurrently?

  • (A)
    T1 runs first and prints 1, T2 runs next and prints 2
  • (B)
    T2 runs first and prints 1, T1 runs next and prints 2
  • (C)
    T1 runs first and prints 1, T2 does not print anything (deadlock)
  • (D)
    T2 runs first and prints 1, T1 does not print anything (deadlock)

Answer (official key): B, C

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

Q51 · Computer Organization and Architecture · Numerical · 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 PP. 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 PP:

  • 20% instructions incur an average of 2 cycles stall due to data hazards
  • 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 _________

Answer (official key): 2.9 to 3.1

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

Q52 · Operating System · Numerical · 2 marks

Consider a 32-bit system with 4 KB page size and page table entries of size 4 bytes each. Assume 1 KB=2101\text{ KB} = 2^{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 XX denote the minimum and YY denote the maximum number of pages across the two levels of the page table of the process.

The value of X+YX+Y is ________

Answer (official key): 1028

Read the worked solution

Q53 · Computer Networks · Numerical · 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\times 10^8 meters/sec, then the minimum frame size (in bits) required for collision detection is _________

Answer (official key): 500

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

Q54 · Algorithms · Numerical · 2 marks

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

Graph for Q59

Answer (official key): 9

Read the worked solution

Q55 · Theory of Computation · Numerical · 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 |w| \le 4\,\},

where ∣w∣|w| denotes the length of string ww.

The number of strings in L2L_2 which are also in L1L_1 is ___________

Answer (official key): 15

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

Q56 · Computer Organization and Architecture · Numerical · 2 marks

Not in GATE 2027 syllabus: Secondary storage (magnetic disk)

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 _________

Answer (official key): 29.5 to 30.5

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

Q57 · Discrete Mathematics · Numerical · 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 ________

Answer (official key): 4

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

Q58 · Discrete Mathematics · MSQ · 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?

  • (A)
    All edges in GG have even weight
  • (B)
    All edges in GG have even weight OR all edges in GG have odd weight
  • (C)
    In each cycle CC in GG, all edges in CC have even weight
  • (D)
    In each cycle CC in GG, either all edges in CC have even weight OR all edges in CC have odd weight

Answer (official key): D

Read the worked solution

Q59 · Computer Organization and Architecture · Numerical · 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 _________

Answer (official key): 32

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

Q60 · Theory of Computation · MSQ · 2 marks

Consider a context-free grammar GG with the following 3 rules:

S→aS,S→aSbS,S→cS \to aS,\qquad S \to aSbS,\qquad S \to c

Let w∈L(G)w \in L(G). Let na(w)n_a(w), nb(w)n_b(w), nc(w)n_c(w) denote the number of times aa, bb, cc occur in ww, respectively.

Which of the following statements is/are TRUE?

  • (A)
    na(w)>nb(w)n_a(w) > n_b(w)
  • (B)
    na(w)>nc(w)−2n_a(w) > n_c(w)-2
  • (C)
    nc(w)=nb(w)+1n_c(w)=n_b(w)+1
  • (D)
    nc(w)=2nb(w)n_c(w)=2n_b(w)

Answer (official key): B, C

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

Q61 · Databases · Numerical · 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 ________

Answer (official key): 50

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

Q62 · Discrete Mathematics · Numerical · 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 for Q60

Answer (official key): 2

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

Q63 · Compiler Design · Numerical · 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 = \operatorname{CLOSURE}(\{S' \to \bullet S\}).

The number of items in the set

GOTO⁡(I0,S)\operatorname{GOTO}(I_0, S)

is ___________

Answer (official key): 9

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

Q64 · Computer Organization and Architecture · Numerical · 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 Register2

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 ________

Answer (official key): 34

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

Q65 · Computer Networks · Numerical · 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 _________

Answer (official key): 4

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