1
GATE CSE 2026 Set 2
MCQ (Single Correct Answer)
+2
-0

Consider a table $T$, where the elements $T[i][j], 0 \leq i, j \leq n$, represent the cost of the optimal solutions of different subproblems of a problem that is being solved using a dynamic programming algorithm. The recursive formulation to compute the table entries is as follows:

$$ \begin{array}{ll} T[0][k]=T[k][0]=1 & \text { for } k=0,1,2, \ldots, n \\ T[i][j]=2 T[i-1][j]+3 T[i][j-1] & \text { for } 1 \leq i, j \leq n \end{array} $$

Consider the following two algorithms to compute entries of $T$. Assume that for both the algorithms, for all $0 \leq i, j \leq n, T[i][j]$ has been initialized to 1 .

GATE CSE 2026 Set 2 Algorithms - Dynamic Programming Question 1 English

Algorithm $B_k, k \in\{1,2\}$ is said to be correct if and only if it calculates the correct values of $T[i][j]$, for all $0 \leq i, j \leq n$, (as per the recursive formulation) at the end of the execution of the algorithm $B_k$.

Which one of the following statements is true?

A

Both algorithms $B_1$ and $B_2$ are correct

B

Algorithm $B_1$ is correct, but algorithm $B_2$ is incorrect

C

Algorithm $B_2$ is correct, but algorithm $B_1$ is incorrect

D

Both algorithms $B_1$ and $B_2$ are incorrect

2
GATE CSE 2026 Set 2
Numerical
+1
-0

A lexical analyzer uses the following token definitions

  • letter → [A - Za - z]

  • digit → [0-9]

  • id → letter (letter $\mid$ digit)*

  • number → digit $^{+}$

  • ws → (blank | tab | newline) ${ }^{+}$

For the string given below,

$x1 \quad 23mm \quad 78\quad$ y $\quad7 z \quad z z 5 \quad 14 A \quad 8 H \quad A a Y c D$

the number of tokens (excluding ws) that will be produced by the lexical analyzer is

$\_\_\_\_$ . (answer in integer)

Your input ____
3
GATE CSE 2026 Set 2
MCQ (Single Correct Answer)
+2
-0

Consider the canonical $L R(0)$ parsing of the grammar below using terminals $\{a, b, c\}$ and non-terminals $\{A, B, C, S\}$ with $S$ as the start symbol.

$$ \begin{aligned} & S \rightarrow A C B \\ & A \rightarrow \alpha A \mid \in \\ & C \rightarrow c C \mid \in \\ & B \rightarrow b B \mid b \end{aligned} $$

Which one of the following options gives the number of shift-reduce conflicts that will occur in the $L R(0)$ ACTION table?

A

2

B

3

C

4

D

5

4
GATE CSE 2026 Set 2
MCQ (Single Correct Answer)
+2
-0

Consider the control flow graph given below.

GATE CSE 2026 Set 2 Compiler Design - Code Generation and Optimization Question 2 English

Which one of the following options is the set of live variables at the exit point of each basic block?

A

B1: $\{a, b, c, e, f\}, B 2:\{d, e\}, B 3:\{b, c, e, f\}, B 4: \phi$

B

B1: $\phi, B 2:\{d, e\}, B 3:\{a, c, f\}, B 4: \phi$

C

B1: $\{a, b, c, e, f\}, B 2:\{d, e\}, B 3:\{c, e, f\}, B 4: \phi$

D

B1: $\phi, B 2:\{d, e, f\}, B 3:\{a, b, c, e, f\}, B 4: \phi$