1
GATE CSE 2026 Set 1
MCQ (More than One Correct Answer)
+1
-0

Consider the following C statements:

char str1 = "Hello; / Statement S1 */

char str2 = "Hello;"; / Statement S2 */

int str3 = "Hello"; / Statement S3 */

Which of the following options is/are correct?

A

S 1 and S 2 have syntactic errors

B

S 2 has a lexical error and S 3 has a syntactic error

C

S 1 has a lexical error and S 3 has a semantic error

D

S1 has a syntactic error and S3 has a semantic error

2
GATE CSE 2026 Set 1
MCQ (More than One Correct Answer)
+1
-0

Which of the following statements is/are true?

A

$\mathrm{LL}(1)$ parser uses backtracking

B

For a grammar to be $\mathrm{LL}(1)$, it must be left-recursive

C

For a grammar to be $\mathrm{LL}(1)$, it must be left-factored

D

The $\mathrm{LL}(1)$ parsers are more powerful than the SLR parsers

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

$$ \text { Consider the control flow graph shown in the figure. } $$

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

Which one of the following options correctly lists the set of redundant expressions (common sub-expressions) in the basic blocks B4 and B5?

Note: All the variables are integers.

A

$$ \begin{aligned} & \text { B4: }\{b+i\} \\ & \text { B5: }\{c+m\} \end{aligned} $$

B

$$ \begin{aligned} & \text { B4: }\{g * k\} \\ & \text { B4: }\{c+m\} \end{aligned} $$

C

$$ \begin{aligned} & \text { B4: }\{g * k, b+i\} \\ & \text { B5: }\} \end{aligned} $$

D

$$ \begin{aligned} & \text { B4: }\{g * k\} \\ & \text { B5: }\} \end{aligned} $$

4
GATE CSE 2026 Set 1
MCQ (More than One Correct Answer)
+2
-0

$$ \text { Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations. } $$

SDD1
Grammar(G1) $$
\text { Semantic Rules }
$$
$$
\mathrm{D} \rightarrow \mathrm{TV}
$$
$$
\begin{aligned}
& \text { D.type = T.type } \\
& \text { V.type = T.type }
\end{aligned}
$$
$$
\mathrm{T} \rightarrow \mathrm{int}
$$
$$
\text { T.type = int }
$$
$$
\mathrm{T} \rightarrow \text { float }
$$
$$
\text { T.type = float }
$$
$$
\mathrm{V} \rightarrow \mathrm{~V}_1 \mathrm{id}
$$
$$
\begin{aligned}
& V_1 \cdot \text { type }=\text { V.type } \\
& \text { put(id.entry, V.type) }
\end{aligned}
$$
$$
\mathrm{V} \rightarrow \mathrm{id}
$$
$$
\text { put(id.entry, V.type) }
$$
SDD2
Grammar(G2) $$
\text { Semantic Rules }
$$
$$
\mathrm{D} \rightarrow D_1 \mathrm{id}
$$
$$
\begin{aligned}
& \text { D.type }=D_1 \cdot \text { type } \\
& \text { put(id.entry, } D_1 \cdot \text { type) }
\end{aligned}
$$
$$
\mathrm{D} \rightarrow \mathrm{~T} \text { id }
$$
$$
\begin{aligned}
& \text { D.type = T.type } \\
& \text { put(id.entry, T.type) }
\end{aligned}
$$
$$
\mathrm{T} \rightarrow \text { int }
$$
$$
\text { T.type = int }
$$
$$
\mathrm{T} \rightarrow \text { float }
$$
$$
\text { T.type = float }
$$
$D$ is the start symbol, and int, float and id are the three terminals. The non-terminal $V_1$ is the same as $V$ and the non-terminal $D_1$ is the same as $D$. Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function put updates the symbol table with the type information for an identifier. Let $P$ and $Q$ be the languages specified by grammars G1 and G2, respectively. Which of the following statements is/are true?
A

The languages P and Q are the same

B

SDD2 is S-attributed and contains only synthesized attributes

C

SDD1 is L-attributed and contains only inherited attributes

D

The specifications of SDD1 and SDD2 are such that the same entries get added to the symbol table