GATE CSE 2024 Set 2

GATE 2024 Previous Year

3 hDuration
100Total Marks
65Questions
12Sections
Log in to start →

Instructions

General instructions for this test:

  • Duration: 3 h. The timer starts as soon as you begin and cannot be paused.
  • Total questions: 65 across 12 section(s); maximum marks: 100.
  • You are allowed 1 attempt(s) at this test.
  • Use the question palette on the right to navigate. Answered questions are highlighted in green; questions marked for review are highlighted in yellow.
  • Each question's marking scheme (correct / wrong) is shown on the question card. Unanswered questions receive zero marks.
  • Switching tabs, exiting full-screen, or attempting to copy text is monitored. Repeated tab-switching may auto-submit the test.
  • Your answers autosave as you navigate. Click Submit Test when you are done. The test will be auto-submitted when the timer expires.

No exam-specific instructions were provided for this paper.

Paper Structure

Compiler Design

Compiler Design

Q1. mcq single +2 / 0.66
Consider the following expression: $x[i] = (p + r) * -s[i] + \frac{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?
Q2. mcq single +1 / 0.33
Consider the following two sets: **Set X** P. Lexical Analyzer Q. Syntax Analyzer R. Intermediate Code Generator S. Code Optimizer **Set Y** 1. Abstract Syntax Tree 2. Token 3. Parse Tree 4. Constant Folding Which one of the following options is the correct match from **Set X** to **Set Y**?
Q3. mcq single +2 / 0.66
Consider the following context-free grammar where the start symbol is S and the set of terminals is {a,b,c,d}. $ S \rightarrow AaAb \mid BbBa $ $ A \rightarrow cS \mid \epsilon $ $ B \rightarrow dS \mid \epsilon $ The following is a partially-filled LL(1) parsing table. abcd$**S**S $\rightarrow$ AaAbS $\rightarrow$ BbBa(1)(2)**A**A $\rightarrow \epsilon$(3)A $\rightarrow$ cS**B**(4)B $\rightarrow \epsilon$B $\rightarrow$ 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.*
Q4. mcq multi +1 / 0
Which of the following statements is/are FALSE?
Q5. numerical +2 / 0
Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is $\{ a, b, c, d, \, \#, \, @ \}$ $S' \rightarrow S$ $S \rightarrow SS \;|\; Aa \;|\; bAc \;|\; Bc \;|\; bBa$ $A \rightarrow d\#\#$ $B \rightarrow @$ Let $I_0 = \text{CLOSURE}( \{ S' \rightarrow \bullet S \} )$. The number of items in the set $GOTO(I_0, \, S)$ is __________.
Data Structures

Data Structures

Q1. mcq single +2 / 0.66
You are given a set $V$ of distinct integers. A binary search tree $T$ is created by inserting all elements of $V$ one by one, starting with an empty tree. The tree $T$ 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 $T$, and you do not have access to $T$. Which one of the following statements is TRUE?
Q2. mcq multi +2 / 0
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 S1400 (Top)300200100Stack S2Only 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?
Database Management System

Database Management System

Q1. numerical +2 / 0
A functional dependency $F: X \to 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 _________
Q2. mcq single +1 / 0.33
In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one of the following statements is TRUE?
Q3. mcq multi +1 / 0
Which of the following file organizations is/are I/O efficient for the scan operation in DBMS?
Q4. mcq multi +1 / 0
Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?
Q5. mcq single +1 / 0.33
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
Q6. mcq single +2 / 0.66
The relation schema, **Person**($\underline{\text{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
Algorithms

Algorithms

Q1. mcq single +1 / 0.33
Let $T(n)$ be the recurrence relation defined as follows: $T(0) = 1$ $T(1) = 2$, and $T(n) = 5T(n - 1) - 6T(n - 2)$ for $n \geq 2$ Which one of the following statements is TRUE?
Q2. mcq single +2 / 0
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$?
Q3. numerical +2 / 0
The number of distinct minimum-weight spanning trees of the following graph is ________
Q4. numerical +1 / 0
Let $A$ be an array containing integer values. The distance of $A$ is defined as the minimum number of elements in $A$ 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 __________
Programming Languages

Programming Languages

Q1. mcq multi +1 / 0
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?
Q2. mcq single +2 / 0.66
What is the output of the following C program? #include <studio.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;}
Q3. mcq single +2 / 0.66
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) and (Q). int first=0, second=0, len1=0, len2=0, maxlen=0; for (int i=0; i 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.)
Q4. mcq single +1 / 0.33
Consider the following C program. Assume parameters to a function are evaluated from right to left. #include <studio.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?
Digital Logic

Digital Logic

Q1. mcq multi +1 / 0
For a Boolean variable x, which of the following statements is/are FALSE?
Q2. mcq multi +2 / 0
Consider 4-variable functions $f1, f2, f3, f4$ expressed in sum-of-minterms form as given below. $f1 = \sum(0,2,3,5,7,8,11,13)$ $f2 = \sum(1,3,5,7,11,13,15)$ $f3 = \sum(0,1,4,11)$ $f4 = \sum(0,2,6,13)$ With respect to the circuit given above, which of the following options is/are CORRECT?
Q3. mcq multi +2 / 0
Which of the following is/are EQUAL to 224 in radix-5 (i.e., base-5) notation?
Q4. mcq single +1 / 0.33
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.
General Aptitude

General Aptitude

Q1. mcq single +1 / 0.33
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?
Q2. mcq single +2 / 0.66
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.
Q3. mcq single +2 / 0.66
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?
Q4. mcq single +1 / 0.33
For positive non-zero real variables $x$ and $y$, if $\ln \left( \frac{x + y}{2} \right) = \frac{1}{2} [ \ln (x) + \ln (y) ]$ then, the value of $\frac{x}{y} + \frac{y}{x}$ is
Q5. mcq single +1 / 0.33
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?
Q6. mcq single +1 / 0.33
In the sequence 6, 9, 14, $x$, 30, 41, a possible value of $x$ is
Q7. mcq single +1 / 0.33
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/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
Q8. mcq single +2 / 0.66
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
Q9. mcq single +2 / 0.66
In the $4 \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
Q10. mcq single +2 / 0.66
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
Theory Of Computation

Theory Of Computation

Q1. mcq multi +2 / 0
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?
Q2. mcq single +1 / 0.33
Which one of the following regular expressions is equivalent to the language accepted by the DFA given below?
Q3. numerical +2 / 0
Let *L~1~* be the language represented by the regular expression *b^(*)ab^(*)(ab^(*)ab^(*))^(*)* and *L~2~ = { w ∈ (a + b)^(*) | |w| ≤ 4 }*, where |w| denotes the length of string *w*. The number of strings in *L~2~* which are also in *L~1~* is __________.
Q4. mcq single +2 / 0.66
Let *M* be the 5-state NFA with ε-transitions shown in the diagram below. Which one of the following regular expressions represents the language accepted by *M*?
Computer Networks

Computer Networks

Q1. numerical +2 / 0
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 _________
Q2. numerical +2 / 0
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 _________
Q3. mcq single +1 / 0
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?
Q4. mcq multi +1 / 0
Which of the following fields of an IP header is/are **always** modified by any router before it forwards the IP packet?
Q5. mcq single +2 / 0.66
Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?
Q6. mcq multi +1 / 0
Which of the following statements about IPv4 fragmentation is/are TRUE?
Discrete Mathematics

Discrete Mathematics

Q1. mcq single +2 / 0.66
Let $ x $ and $ y $ be random variables, not necessarily independent, that take real values in the interval $[0,1]$. Let $ z = xy $ and let the mean values of $ x, y, z $ be $ \bar{x} , \bar{y} , \bar{z} $, respectively. Which one of the following statements is TRUE?
Q2. mcq single +1 / 0.33
When six unbiased dice are rolled simultaneously, the probability of getting all distinct numbers (i.e., 1, 2, 3, 4, 5, and 6) is
Q3. mcq single +1 / 0.33
Let *p* and *q* be the following propositions: *p*: Fail grade can be given. *q*: 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?
Q4. numerical +2 / 0
Let *Z~n~* be the group of integers {0, 1, 2, ..., *n* − 1} with addition modulo *n* as the group operation. The number of elements in the group *Z~2~ × Z~3~ × Z~4~* that are their own inverses is __________.
Q5. numerical +1 / 0
Let $P$ be the partial order defined on the set {1,2,3,4} as follows: $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} that contain $P$ is _________.
Q6. mcq multi +2 / 0
Let A be an n × n matrix over the set of all real numbers ℝ. Let B be a matrix obtained from A by swapping two rows. Which of the following statements is/are TRUE?
Q7. numerical +2 / 0
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 ________
Q8. mcq single +1 / 0.33
Let $A$ be the adjacency matrix of a simple undirected graph $G$. Suppose $A$ is its own inverse. Which one of the following statements is always TRUE?
Q9. mcq single +1 / 0.33
Let $f(x)$ be a continuous function from $\mathbb{R}$ to $\mathbb{R}$ such that $f(x) = 1 - f(2 - x)$ Which one of the following options is the CORRECT value of $\int_0^2 f(x) dx$?
Operating Systems

Operating Systems

Q1. mcq multi +2 / 0
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?
Q2. mcq multi +1 / 0
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)?
Q3. mcq single +2 / 0.66
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?
Q4. numerical +2 / 0
Consider a 32-bit system with 4 KB page size and page table entries of size 4 bytes each. Assume 1 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 $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 __________.
Q5. mcq multi +1 / 0
Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?
Q6. numerical +2 / 0
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 _________
Computer Organization

Computer Organization

Q1. numerical +2 / 0
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 ________
Q2. mcq single +1 / 0
**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?
Q3. mcq single +1 / 0.33
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?
Q4. numerical +2 / 0
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:OPCODEUNUSEDDST RegisterSRC Register1SRC Register2I-type Instruction Format:OPCODEDST RegisterSRC Register# Immediate value/addressIn 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 *X* be the number of bits used to encode the UNUSED field, *Y* be the number of bits used to encode the OPCODE field, and *Z* be the number of bits used to encode the immediate value/address field. The value of *X + 2Y + Z* is __________.
Q5. numerical +2 / 0
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 _________