Compiler Design questions

Q12

GATE CS 2025 CS-1Lexical AnalysisMCQ1 mark−1/3 if wrong
Which ONE of the following statements is FALSE regarding the symbol table?
Show answer without attempting

Answer: C

Q13

GATE CS 2025 CS-1Optimization and Data FlowMCQ1 mark−1/3 if wrong
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Show answer without attempting

Answer: B

Q46

GATE CS 2025 CS-1ParsingMSQ2 marks
Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q52

GATE CS 2025 CS-1Intermediate CodeNAT2 marks
Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is ________. (Answer in integer)
1001: i = 1
1002: j = 1
1003: t1 = 10*i
1004: t2 = t1+j
1005: t3 = 8*t2
1006: t4 = t3-88
1007: a[t4] = 0.0
1008: j = j+1
1009: if j <= 10 goto 1003
1010: i = i+1
1011: if i <= 10 goto 1002
1012: i = 1
1013: t5 = i-1
1014: t6 = 88*t5
1015: a[t6] = 1.0
1016: i = i+1
1017: if i <= 10 goto 1013
Show answer without attempting

Answer: 6

Q21

GATE CS 2025 CS-2Intermediate CodeMCQ1 mark−1/3 if wrong
Consider the following statements about the use of backpatching in a compiler for intermediate code generation:

(I) Backpatching can be used to generate code for Boolean expression in one pass.
(II) Backpatching can be used to generate code for flow-of-control statements in one pass.

Which ONE of the following options is CORRECT?
Show answer without attempting

Answer: C

Q22

GATE CS 2025 CS-2Syntax Directed TranslationMCQ1 mark−1/3 if wrong
Given the following syntax directed translation rules:

Rule 1: R→AB{B.i=R.i−1;A.i=B.i;R.i=A.i+1;}R \rightarrow AB \{B.i = R.i - 1; A.i = B.i; R.i = A.i + 1;\}
Rule 2: P→CD{P.i=C.i+D.i;D.i=C.i+2;}P \rightarrow CD \{P.i = C.i + D.i; D.i = C.i + 2;\}
Rule 3: Q→EF{Q.i=E.i+F.i;}Q \rightarrow EF \{Q.i = E.i + F.i;\}

Which ONE is the CORRECT option among the following?
Show answer without attempting

Answer: C

Q40

GATE CS 2025 CS-2ParsingMCQ2 marks−2/3 if wrong
Given a Context-Free Grammar GG as follows:

S→Aa∣bAc∣dc∣bdaS \rightarrow Aa \mid bAc \mid dc \mid bda
A→dA \rightarrow d

Which ONE of the following statements is TRUE?
Show answer without attempting

Answer: C

Q51

GATE CS 2025 CS-2ParsingMSQ2 marks
Consider two grammars G1G_1 and G2G_2 with the production rules given below:

G1:S→if E then S∣if E then S else S∣aG_1: S \rightarrow \text{if } E \text{ then } S \mid \text{if } E \text{ then } S \text{ else } S \mid a
E→bE \rightarrow b

G2:S→if E then S∣MG_2: S \rightarrow \text{if } E \text{ then } S \mid M
M→if E then M else S∣cM \rightarrow \text{if } E \text{ then } M \text{ else } S \mid c
E→bE \rightarrow b

where if,then,else,a,b,c\text{if}, \text{then}, \text{else}, a, b, c are the terminals.

Which of the following option(s) is/are CORRECT?
More than one option can be correct.
Show answer without attempting

Answer: C, D

0/80 correct0 marks

Related topics in GATE CS