Skip to content

GATE CS question library

Practise GATE CS Computer Science previous year questions free. Browse by subject, syllabus topic, year and question type, with answers and available solutions.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

20 on this page
Official PYQ2021DatabasesTransactions and Concurrency ControlMCQ · 2 marks
Let ri(z)r_i(z) and wi(z)w_i(z) denote read and write operations respectively on a data item zz by a transaction TiT_i. Consider the following two schedules. S1:r1(x)r1(y)r2(x)r2(y)w2(y)w1(x)S_1: r_1(x)r_1(y)r_2(x)r_2(y)w_2(y)w_1(x) S2:r1(x)r2(x)r2(y)w2(y)r1(y)w1(x)S_2: r_1(x)r_2(x)r_2(y)w_2(y)r_1(y)w_1(x) Which one of the following options is correct?
Official PYQ2021Engineering MathematicsMonoids and GroupsMCQ · 2 marks
Let GG be a group of order 66, and HH be a subgroup of GG such that 1<∣H∣<61<|H|<6. Which one of the following options is correct?
Official PYQ2021DatabasesNormal FormsMCQ · 2 marks
Consider the relation R(P,Q,S,T,X,Y,Z,W)R(P,Q,S,T,X,Y,Z,W) with the following functional dependencies. PQ→X;P→YX;Q→Y;Y→ZWPQ\rightarrow X;\quad P\rightarrow YX;\quad Q\rightarrow Y; \quad Y\rightarrow ZW Consider the decomposition of the relation RR into the constituent relations according to the following two decomposition schemes. …
Official PYQ2021Engineering MathematicsProbability: Random Variables and DistributionsMCQ · 2 marks
Consider the two statements. S1:S_1:\quad There exist random variables XX and YY such that (E[(X−E(X))(Y−E(Y))])2>Var[X]Var[Y]\left(\mathbb E[(X-\mathbb E(X))(Y-\mathbb E(Y))]\right)^2>\textsf{Var}[X]\textsf{Var}[Y] S2:S_2:\quad For all random variables XX and Y,Cov[X,Y]=E[∣X−E[X]∣  ∣Y−E[Y]∣]Y, \textsf{Cov}[X,Y]=\mathbb E \left[|X-\mathbb E[X]|\;|Y-\mathbb E[Y]|\right ] Which one of the following …
Official PYQ2021Engineering MathematicsGraphs: Connectivity, Matching, ColouringMCQ · 2 marks
Let G=(V,E)G=(V, E) be an undirected unweighted connected graph. The diameter of GG is defined as: diam(G)=max⁡u,v∈V{the length of shortest path between u and v}\text{diam}(G)=\displaystyle \max_{u,v\in V} \{\text{the length of shortest path between $u$ and $v$}\} Let MM be the adjacency matrix of GG. Define graph G2G_2 on the same set of vertices with adjacency matrix NN, where …
Official PYQ2021Programming and Data StructuresProgramming in CMCQ · 2 marks
​​​​​Consider the following ANSI C\text{ ANSI C} program. #include <stdio.h> int main() { int i, j, count; count=0; i=0; for (j=-3; j<=3; j++) { if (( j >= 0) && (i++)) count = count + j; } count = count +i; printf("%d", count); return 0; } Which one of the following options is correct?
Official PYQ2021Theory of ComputationRegular Expressions and Finite AutomataMCQ · 2 marks
Consider the following language: L={w∈{0,1}∗∣w ends with the substring 011}L= \{ w \in \{0,1\}^* \mid w \text{ ends with the substring } 011 \} Which one of the following deterministic finite automata accepts L?L?
Official PYQ2021Theory of ComputationUndecidabilityMCQ · 2 marks
For a Turing machine MM, ⟨M⟩\langle M \rangle denotes an encoding of MM. Consider the following two languages. L1={⟨M⟩∣M takes more than 2021 steps on all inputs}L2={⟨M⟩∣M takes more than 2021 steps on some input}\begin{array}{ll} L_1 = \{ \langle M \rangle \mid M \text{ takes more than } 2021 \text{ steps on all inputs} \} \\ L_2 = \{ \langle M \rangle \mid M\text{ takes more than } 2021 \text{ steps on some input} \} \end{array} Which one of the …
Official PYQ2021AlgorithmsAlgorithm Design: Greedy TechniquesMSQ · 2 marks
Define RnR_n to be the maximum amount earned by cutting a rod of length nn meters into one or more pieces of integer length and selling them. For i>0i>0, let p[i]p[i] denote the selling price of a rod whose length is ii meters. Consider the array of prices: …
Official PYQ2021Programming and Data StructuresTreesMCQ · 2 marks
An articulationarticulation pointpoint in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components. Let TT be a DFS\text{DFS} tree obtained by doing DFS\text{DFS} in a connected undirected graph GG. Which of the following options is/are correct?
Official PYQ2021Digital LogicBoolean AlgebraMSQ · 2 marks
Consider the following Boolean expression. F=(X+Y+Z)(X‾+Y)(Y‾+Z)F=(X+Y+Z)(\overline X +Y)(\overline Y +Z) Which of the following Boolean expressions is/are equivalent to F‾\overline F (complement of FF)?
Official PYQ2021Engineering MathematicsSets, Relations and FunctionsMCQ · 2 marks
A relation RR is said to be circular if aRba\text{R}b and bRcb\text{R}c together imply cRac\text{R}a. Which of the following options is/are correct?
Official PYQ2021Computer NetworksTransport Layer: Flow Control, Congestion Control, UDP, TCP, SocketsMSQ · 2 marks
A TCP\text{TCP} server application is programmed to listen on port number PP on host SS. A TCP\text{TCP} client is connected to the TCP\text{TCP} server over the network. Consider that while the TCP\text{TCP} connection was active, the server machine SS crashed and rebooted. Assume that the client does not use the TCP\text{TCP} keepalive timer. …
Official PYQ2021Computer NetworksTransport Layer: Flow Control, Congestion Control, UDP, TCP, SocketsMSQ · 2 marks
Consider two hosts PP and QQ connected through a router RR. The maximum transfer unit (MTU)\text{(MTU)} value of the link between PP and RR is 15001500 bytes, and between RR and QQ is 820820 bytes. A TCP\text{TCP} segment of size 14001400 bytes was transferred from PP to QQ through RR, with IP\text{IP} identification value as …
Official PYQ2021Operating SystemConcurrency and SynchronizationMSQ · 2 marks
Consider the following pseudocode, where S\textsf{S} is a semaphore initialized to 55 in line #2\#2 and counter\textsf{counter} is a shared variable initialized to 00 in line #1\#1. Assume that the increment operation in line #7\#7 is not\textit{not} atomic. 1. int counter = 0; 2. Semaphore S = init(5); 3. void parop(void) 4. { 5. wait(S); 6. …
Official PYQ2021AlgorithmsSearching, Sorting, HashingMCQ · 2 marks
Consider a dynamic\textit{dynamic} hashing approach for 44-bit integer keys: There is a main hash table of size 44. The 22 least significant bits of a key is used to index into the main hash table. Initially, the main hash table entries are empty. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to …
Official PYQ2021AlgorithmsAsymptotic Worst Case Time and Space ComplexityNAT · 2 marks
Consider the following ANSI C\text{ANSI C} function: int SimpleFunction(int Y[], int n, int x) { int total = Y[0], loopIndex; for (loopIndex=1; loopIndex<=n-1; loopIndex++) total=x*total +Y[loopIndex]; return total; } Let Z\textsf{Z} be an array of 1010 elements with Z[i]=1\textsf{Z}[i]=1, for all ii such that 0≤i≤90 \leq i \leq 9. The value returned …
Official PYQ2021Computer NetworksTransport Layer: Flow Control, Congestion Control, UDP, TCP, SocketsNAT · 2 marks
Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following: The time taken for processing the data frame by the receiver is negligible. The time taken for processing the acknowledgement frame by the sender is negligible. The sender has infinite number of frames …
Official PYQ2021Theory of ComputationContext-free Grammars and Push-down AutomataNAT · 2 marks
In a pushdown automaton P=(Q,Σ,Γ,δ,q0,F)P=(Q, \Sigma, \Gamma, \delta, q_0, F), a transition of the form, where p,q∈Qp,q \in Q, a∈Σ∪{ϵ}a \in \Sigma \cup \{ \epsilon \}, and X,Y∈Γ∪{ϵ}X,Y \in \Gamma \cup \{ \epsilon \}, represents (q,Y)∈δ(p,a,X).(q,Y) \in \delta(p,a,X).Consider the following pushdown automaton over the input alphabet Σ={a,b}\Sigma = \{a,b\} and stack alphabet …
Official PYQ2021Compiler DesignLocal OptimizationNAT · 2 marks
Consider the following CC code segment: a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f; In a compiler, this code segment is represented internally as a directed acyclic graph (DAG)\text{(DAG)}. The number of nodes in the DAG\text{DAG} is _____________