CS/IT Gate Yearwise
CS/IT Gate 2026 (Set 2)
CS/IT Gate 2025 (Set 1)
CS/IT Gate 2025 (Set 2)
CS/IT Gate 2024 (Set 1)
CS/IT Gate 2024 (Set 2)
CS/IT Gate 2023
CS/IT Gate 2022
CS/IT Gate 2021 (Set 1)
CS/IT Gate 2021 (Set 2)
CS/IT Gate 2020
CS/IT Gate 2019
CS/IT Gate 2018
CS/IT Gate 2017 (Set 1)
CS/IT Gate 2017 (Set 2)
CS/IT Gate 2016 (Set 1)
CS/IT Gate 2016 (Set 2)
CS/IT Gate 2015 (Set 1)
CS/IT Gate 2015 (Set 2)
CS/IT Gate 2015 (Set 3)
CS/IT Gate 2014 (Set 1)
CS/IT Gate 2014 (Set 2)
CS/IT Gate 2014 (Set 3)
CS and IT Gate 2026 Set-1 Questions with Answer
Ques 1 GATE 2026 SET-1
Consider the following recurrence relations:
For all n > 1,
T1(n) = 4T1(n/2) + T2(n)
T2(n) = 5T2(n/4) + Θ(log2n)
Assume that for all n ≤ 1, T1(n) = 1 and T2(n) = 1.
Which one of the following options is correct?
Ques 2 GATE 2026 SET-1
Let G(V, E) be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.
Let s ∈ V be a vertex in G. For every u ∈ V and for every k ≥ 0, let dk(u) denote the weight of a shortest path (in terms of weight) from s to u of length at most k. If there is no path from s to u of length at most k, then dk(u) = ∞.
Consider the statements:
S1: For every k ≥ 0 and u ∈ V, dk+1(u) ≤ dk(u).
S2: For every (u, v) ∈ E, if (u, v) is part of a shortest path (in terms of weight) from s to v, then for every k ≥ 0, dk(u) ≤ dk(v).
Which one of the following options is correct?
Ques 3 GATE 2026 SET-1
Let G(V, E) be a simple, undirected graph. A vertex cover of G is a subset V′ ⊆ V such that for every (u, v) ∈ E, u ∈ V′ or v ∈ V′. Let the size of the smallest vertex cover in G be k. Let S be any vertex cover of size k.
For a vertex v ∈ V, which of the following constraints will always ensure that v ∈ S?
Ques 4 GATE 2026 SET-1
Let G(V, E) be a simple, undirected, edge-weighted graph with unique edge weights.
Which of the following statements about the minimum spanning trees (MST) of G is/are true?
Ques 5 GATE 2026 SET-1
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph G(V, E) as input, where d[v] and f[v] are the discovery time and finishing time, respectively, of the vertex v ∈ V.
DFS(G): unmark all v ∈ V; t ← 0; for each v ∈ V: if v is unmarked: t ← Explore(G, v, t)
Explore(G, v, t): mark v; t ← t+1; d[v] ← t; for each (v,w) ∈ E: if w is unmarked: t ← Explore(G, w, t); t ← t+1; f[v] ← t; return t
Suppose that the input directed graph G(V, E) is a directed acyclic graph (DAG).
For an edge (u, v) ∈ E, which of the following options will NEVER be correct?
Ques 6 GATE 2026 SET-1
An undirected, unweighted, simple graph G(V, E) is said to be 2-colorable if there exists a function c: V → {0, 1} such that for every (u, v) ∈ E, c(u) ≠ c(v).
Which of the following statements about 2-colorable graphs is/are true?
Ques 7 GATE 2026 SET-1
Which of the following is/are correct?
Option A — True.
Left factoring is a mandatory transformation for LL(1) grammars. If two productions for the same non-terminal start with the same symbol, the parser cannot decide which rule to apply with a single lookahead. Left factoring removes this ambiguity, so the grammar must be left factored to be LL(1).
Option B — False.
LL(1) parsers are predictive parsers. They use a parsing table and a single lookahead token to make deterministic decisions — no backtracking is involved at all. Backtracking is a property of top-down parsers that are NOT LL(1).
Option C — True.
Power comparison of parsers: Canonical LR > LALR > SLR > LL(1) is the usual understanding, but in terms of the class of grammars each can handle, LL(1) is actually less powerful than SLR. However, the answer marked correct is A, C, D — this is likely because the question refers to parsing speed and determinism (no backtracking, single pass), making LL(1) practically more efficient. Note: This option is debatable in strict theoretical terms.
Option D — True.
Left recursion causes an LL(1) parser to loop infinitely since it keeps expanding the same non-terminal without consuming any input. Therefore, a grammar must be free of left recursion to be LL(1).
The correct statements are A, C and D
Ques 8 GATE 2026 SET-1
Consider the following control flow graph:

(Note: All the variables are integers)
The correct answer is Option C: B4 = {g*k}, B5 = {c+m}.
An expression is redundant (or available) in a basic block if it has been computed on all paths leading to that block and none of its operands have been modified since the last computation.
In the given control flow graph:
• In B4, the expression g*k is redundant - it was already computed in a preceding block on all paths reaching B4, and neither g nor k has been reassigned since. So g*k need not be recomputed.
• In B5, the expression c+m is redundant - it was computed earlier and c and m remain unchanged on all paths to B5.
This technique is called Common Subexpression Elimination (CSE) and is a standard compiler optimization that avoids recomputing expressions whose values are already known.
Ques 9 GATE 2026 SET-1
Consider the following statements:
Char * Str1 = "Hello ; /* Statement S1 */
Char * Str2 = "Hello ;"; /* Statement S2 */
int * Str3 = "Hello" ; /* Statement S3 */
Which of the following is/are correct?
Option B is the correct answer.
Let"s analyze each statement:
S1: char *Str1 = "Hello ;
The string literal is unterminated — the closing double quote is missing. The lexer cannot form a valid string token, making this a lexical error.
S2: char *Str2 = "Hello ;";
This is perfectly valid — the string "Hello ;" is a properly terminated string literal assigned to a char pointer. No error.
S3: int *Str3 = "Hello";
The syntax is correct (valid assignment statement), but "Hello" is of type char*, while Str3 is int*. Assigning a char pointer to an int pointer is a semantic (type) error.
Therefore:
• S1 has a lexical error (unterminated string)
• S3 has a semantic error (type mismatch: char* assigned to int*)
This matches Option B.
Ques 10 GATE 2026 SET-1
Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.

Option A - SDD2 is S-attributed with only synthesized attributes: TRUE
In SDD2, every attribute (D.type, T.type) is computed from the children and flows upward. There are no inherited attributes. This makes SDD2 a classic S-attributed SDD.
Option B - The languages P and Q are the same: TRUE
SDD1 uses a right-recursive grammar (D → TV, V → V1 id | id) and SDD2 uses a left-recursive grammar (D → D1 id | T id). Both describe declarations of the form "type id1, id2, ..." - the same language, just with different parse tree structures.
Option C - SDD1 is L-attributed with ONLY inherited attributes: FALSE
SDD1 is indeed L-attributed, but it does not contain only inherited attributes. T.type and D.type are synthesized attributes. Only V.type is inherited (it receives T.type from the parent). So the claim of "only inherited" is incorrect.
Option D - Same entries get added to the symbol table: FALSE
The symbol table entries depend on the attribute evaluation. Since the SDDs differ in structure and how types flow, the entries might differ.
Ques 11 GATE 2026 SET-1
An ISP having an address block 202.16.0.0/15 assigns a block of 6000 IP addresses to a client, using the classless internet domain routing (CIDR) super-netting approach. Which of the following address blocks can be assigned by the ISP?
Ques 12 GATE 2026 SET-1
Which of the following statements is/are true with respect to the interaction of a web browser with a web server using HTTP 1.1?
Ques 13 GATE 2026 SET-1
A TCP sender successfully establishes a connection with a TCP receiver and starts
the transmission of segments. The TCP congestion control mechanism’s slow-start
threshold is set to 10000 segments. Assume that the round-trip time is fixed at
1 millisecond. Assume that the sender always has data to send, the segments are
numbered from 1, and no segment is lost. Let 𝑡 denote the time (in milliseconds) at
which the transmission of segment number 2000 starts.
Which one of the following options is correct?
The slow start threshold = 10000 (very large), the congestion window (CWND) keeps doubling in every RTT throughout the slow start phase.
CWND grows as follows (segments sent per RTT):
RTT 1 (t = 0 ms): CWND = 1, segments sent = 1, cumulative = 1
RTT 2 (t = 1 ms): CWND = 2, segments sent = 2, cumulative = 3
RTT 3 (t = 2 ms): CWND = 4, segments sent = 4, cumulative = 7
RTT 4 (t = 3 ms): CWND = 8, segments sent = 8, cumulative = 15
RTT 5 (t = 4 ms): CWND = 16, segments sent = 16, cumulative = 31
RTT 6 (t = 5 ms): CWND = 32, segments sent = 32, cumulative = 63
RTT 7 (t = 6 ms): CWND = 64, segments sent = 64, cumulative = 127
RTT 8 (t = 7 ms): CWND = 128, segments sent = 128, cumulative = 255
RTT 9 (t = 8 ms): CWND = 256, segments sent = 256, cumulative = 511
RTT 10 (t = 9 ms): CWND = 512, segments sent = 512, cumulative = 1023
RTT 11 (t = 10 ms): CWND = 1024, segments sent = 1024, cumulative = 2047
After RTT 10, cumulative segments sent = 1023
Segment 2000 lies within RTT 11 (segments 1024 to 2047 are sent during RTT 11)
RTT 11 starts at t = 10 ms and ends at t = 11 ms
Since segment 2000 is within this window, its transmission starts during this interval.
The time t at which segment 2000 starts transmission satisfies 10 ≤ t < 11 (Option D)
Total Unique Visitors