Compiler Design questions

Q28

GATE CS 2026 CS-1ParsingMSQ1 mark
Which of the following statements is/are true?
More than one option can be correct.
Show answer without attempting

Answer: C

Q42

GATE CS 2026 CS-1Optimization and Data FlowMCQ2 marks−2/3 if wrong
Consider the control flow graph shown in the figure.

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

Note: All the variables are integers.
Question figure
Show answer without attempting

Answer: D

Q53

GATE CS 2026 CS-1Syntax Directed TranslationMSQ2 marks
Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.

DD is the start symbol, and intint, floatfloat and idid are the three terminals. The non-terminal V1V_1 is the same as VV and the non-terminal D1D_1 is the same as DD. Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function putput 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?
Question figure
More than one option can be correct.
Show answer without attempting

Answer: A, B, D

Q17

GATE CS 2026 CS-2Runtime EnvironmentsMCQ1 mark−1/3 if wrong
In C runtime environment, which one of the following is stored in heap?
Show answer without attempting

Answer: C

Q35

GATE CS 2026 CS-2Lexical AnalysisNAT1 mark
A lexical analyzer uses the following token definitions
* letter→[A−Za−z]letter \rightarrow [A - Za - z]
* digit→[0−9]digit \rightarrow [0 - 9]
* id→letter(letter∣digit)∗id \rightarrow letter (letter \mid digit)^*
* number→digit+number \rightarrow digit^+
* ws→(blank∣tab∣newline)+ws \rightarrow (blank \mid tab \mid newline)^+

For the string given below,

x1  23mm  78  y  7z  zz5  14A  8H  AaYcDx1 \; 23mm \; 78 \; y \; 7z \; zz5 \; 14A \; 8H \; AaYcD

the number of tokens (excluding wsws) that will be produced by the lexical analyzer is __________. (answer in integer)
Show answer without attempting

Answer: 13

Q41

GATE CS 2026 CS-2ParsingMCQ2 marks−2/3 if wrong
Consider the canonical LR(0)LR(0) parsing of the grammar below using terminals {a,b,c}\{a, b, c\} and non-terminals {A,B,C,S}\{A, B, C, S\} with SS as the start symbol.

S→ACBS \rightarrow ACB

A→aA∣ϵA \rightarrow aA \mid \epsilon

C→cC∣ϵC \rightarrow cC \mid \epsilon

B→bB∣bB \rightarrow bB \mid b

Which one of the following options gives the number of shift-reduce conflicts that will occur in the LR(0)LR(0) ACTION table?
Show answer without attempting

Answer: D

Q45

GATE CS 2026 CS-2Optimization and Data FlowMCQ2 marks−2/3 if wrong
Consider the control flow graph given below.

Which one of the following options is the set of live variables at the exit point of each basic block?
Question figure
Show answer without attempting

Answer: A

0/70 correct0 marks

Related topics in GATE CS