Crack
GATE
C
G
Topic
Compiler Design
57 questions
0
/ 57 done
Questions per paper
All
MCQ
MSQ
NAT
2015 to 2026. Point at a year to read it.
0
1
2
3
4
5
2015
2019
2021
2023
2025
2026
Show as a table
Year
All
MCQ
MSQ
NAT
2015
2.7
2.3
0
0.3
2018
0
0
0
0
2019
4
2
0
2
2020
2
2
0
0
2021
5
3.5
0.5
1
2022
3
1
0
2
2023
5
4
0
1
2024
5
3
1
1
2025
4
2.5
1
0.5
2026
3.5
1.5
1.5
0.5
1
CS 2026 Set 1 · 1 mark · MSQ · Moderate
Consider the following C statements:
2
CS 2026 Set 1 · 1 mark · MSQ · Moderate
Which of the following statements is/are true?
3
CS 2026 Set 1 · 2 marks · MCQ · Moderate
Consider the control flow graph shown in the figure.
4
CS 2026 Set 1 · 2 marks · MSQ · Hard
Consider the following two syntax-directed definitions
S
D
D
1
\mathrm{SDD1}
SDD1
and
S
D
D
2
\mathrm{SDD2}
SDD2
for type declarations.
5
CS 2026 Set 2 · 1 mark · NAT · Moderate
A lexical analyzer uses the following token definitions
6
CS 2026 Set 2 · 2 marks · MCQ · Moderate
Consider the canonical
L
R
(
0
)
LR(0)
L
R
(
0
)
parsing of the grammar below using terminals {a, b, c} and non-terminals {A, B, C} with
S
S
S
as the start symbol.
7
CS 2026 Set 2 · 2 marks · MCQ · Hard
Consider the control flow graph given below.
8
CS 2025 Set 1 · 1 mark · MCQ · Easy
Which ONE of the following statements is
FALSE
regarding the symbol table?
9
CS 2025 Set 1 · 1 mark · MCQ · Easy
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
10
CS 2025 Set 1 · 2 marks · MSQ · Easy
Which of the following statement(s) is/are TRUE while computing
F
i
r
s
t
\mathit{First}
First
and
F
o
l
l
o
w
\mathit{Follow}
Follow
during top down parsing by a compiler?
11
CS 2025 Set 1 · 2 marks · NAT · Moderate
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)
12
CS 2025 Set 2 · 1 mark · MCQ · Moderate
Consider the following statements about the use of backpatching in a compiler for intermediate code generation:
13
CS 2025 Set 2 · 1 mark · MCQ · Moderate
Given the following syntax directed translation rules:
14
CS 2025 Set 2 · 2 marks · MCQ · Hard
Given a Context-Free Grammar
G
G
G
as follows:
15
CS 2025 Set 2 · 2 marks · MSQ · Moderate
Consider two grammars
G
1
G_1
G
1
and
G
2
G_2
G
2
with the production rules given below:
16
CS 2024 Set 1 · 1 mark · MSQ · Easy
Which of the following is/are Bottom-Up Parser(s)?
17
CS 2024 Set 1 · 1 mark · NAT · Hard
Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below.
18
CS 2024 Set 1 · 2 marks · MCQ · Easy
Consider the following syntax-directed definition (SDD).
19
CS 2024 Set 1 · 2 marks · MCQ · Hard
Consider the following grammar
G
G
G
, with
S
S
S
as the start symbol. The grammar
G
G
G
has three incomplete productions denoted by (1), (2), and (3).
20
CS 2024 Set 1 · 2 marks · MCQ · Moderate
Consider the following pseudo-code.
21
CS 2024 Set 2 · 1 mark · MCQ · Easy
Consider the following two sets:
22
CS 2024 Set 2 · 1 mark · MSQ · Moderate
Which of the following statements is/are FALSE?
23
CS 2024 Set 2 · 2 marks · MCQ · Moderate
Consider the following context-free grammar where the start symbol is
S
S
S
and the set of terminals is
{
a
,
b
,
c
,
d
}
\{a,b,c,d\}
{
a
,
b
,
c
,
d
}
.
24
CS 2024 Set 2 · 2 marks · MCQ · Moderate
Consider the following expression:
x
[
i
]
=
(
p
+
r
)
∗
−
s
[
i
]
+
u
/
w
x[i] = (p + r) * -s[i] + u/w
x
[
i
]
=
(
p
+
r
)
∗
−
s
[
i
]
+
u
/
w
. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).
25
CS 2024 Set 2 · 2 marks · NAT · Moderate
Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is
{
a
,
b
,
c
,
d
,
#
,
@
}
\{a,b,c,d,\#, @\}
{
a
,
b
,
c
,
d
,
#
,
@
}
26
CS 2023 · 1 mark · MCQ · Easy
Consider the following statements regarding the front-end and back-end of a compiler.
27
CS 2023 · 1 mark · MCQ · Moderate
Consider the following definition of a lexical token
i
d
\mathrm{id}
id
for an identifier in a programming language, using extended regular expressions:
28
CS 2023 · 2 marks · MCQ · Moderate
Consider the following program:
29
CS 2023 · 2 marks · MCQ · Moderate
Consider the control flow graph shown.
30
CS 2023 · 2 marks · NAT · Moderate
Consider the syntax directed translation given by the following grammar and semantic rules. Here
N
N
N
,
I
I
I
,
F
F
F
and
B
B
B
are non-terminals.
N
N
N
is the starting non-terminal, and
#
\#
#
,
0
0
0
and
1
1
1
are lexical tokens corresponding to input letters “
#
\#
#
”, “
0
0
0
” and “
1
1
1
”, respectively.
X
.
v
a
l
X.\mathrm{val}
X
.
val
denotes the synthesized attribute (a numeric value) associated with a non-terminal
X
X
X
.
I
1
I_1
I
1
and
F
1
F_1
F
1
denote occurrences of
I
I
I
and
F
F
F
on the right hand side of a production, respectively. For the tokens
0
0
0
and
1
1
1
,
0.
v
a
l
=
0
0.\mathrm{val} = 0
0.
val
=
0
and
1.
v
a
l
=
1
1.\mathrm{val} = 1
1.
val
=
1
.
31
CS 2022 · 1 mark · MCQ · Moderate
Which one of the following statements is TRUE?
32
CS 2022 · 1 mark · NAT · Moderate
Consider the augmented grammar with
{
+
,
∗
,
(
,
)
,
i
d
}
\{+, *, (, ), id\}
{
+
,
∗
,
(
,
)
,
i
d
}
as the set of terminals.
33
CS 2022 · 2 marks · NAT · Moderate
Consider the following grammar along with translation rules.
34
CS 2021 Set 1 · 1 mark · MCQ · Easy
Consider the following statements.
35
CS 2021 Set 1 · 1 mark · MCQ · Moderate
Consider the following statements.
36
CS 2021 Set 1 · 2 marks · MCQ · Moderate
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
37
CS 2021 Set 1 · 2 marks · MCQ · Moderate
Consider the following context-free grammar where the set of terminals is
{
a
,
b
,
c
,
d
,
f
}
\{a, b, c, d, f\}
{
a
,
b
,
c
,
d
,
f
}
.
38
CS 2021 Set 1 · 2 marks · NAT · Moderate
Consider the following C code segment:
39
CS 2021 Set 2 · 1 mark · MCQ · Easy
Consider the following ANSI C program:
40
CS 2021 Set 2 · 1 mark · MSQ · Easy
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
41
CS 2021 Set 2 · 2 marks · MCQ · Hard
Consider the following ANSI C code segment:
42
CS 2021 Set 2 · 2 marks · MCQ · Easy
For a statement
S
S
S
in a program, in the context of liveness analysis, the following sets are defined:
43
CS 2021 Set 2 · 2 marks · NAT · Moderate
Consider the following augmented grammar with
{
#
,
@
,
<
,
>
,
a
,
b
,
c
}
\{\#, @, <, >, a, b, c\}
{
#
,
@
,
<
,
>
,
a
,
b
,
c
}
as the set of terminals.
44
CS 2020 · 1 mark · MCQ · Moderate
Consider the following statements.
45
CS 2020 · 2 marks · MCQ · Easy
Consider the productions
A
→
P
Q
A \rightarrow PQ
A
→
P
Q
and
A
→
X
Y
A \rightarrow XY
A
→
X
Y
. Each of the five non-terminals A, P, Q, X, and Y has two attributes:
s
s
s
is a synthesized attribute, and
i
i
i
is an inherited attribute. Consider the following rules.
46
CS 2019 · 1 mark · MCQ · Easy
Which one of the following kinds of derivation is used by LR parsers?
47
CS 2019 · 1 mark · NAT · Moderate
Consider the grammar given below:
48
CS 2019 · 2 marks · MCQ · Moderate
Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let
X
1
X_1
X
1
,
X
2
X_2
X
2
,
X
3
X_3
X
3
,
X
4
X_4
X
4
,
X
5
X_5
X
5
, and
X
6
X_6
X
6
be the placeholders for the non-terminals D, T, L or
L
1
\text{L}_1
L
1
in the following table:
49
CS 2019 · 2 marks · NAT · Moderate
Consider the augmented grammar given below:
50
CS 2015 Set 1 · 1 mark · MCQ · Easy
Which one of the following is TRUE at any valid state in shift-reduce parsing?
51
CS 2015 Set 1 · 2 marks · MCQ · Moderate
A variable
x
x
x
is said to be live at a statement
S
i
S_i
S
i
in a program if the following three conditions hold simultaneously:
52
CS 2015 Set 1 · 2 marks · NAT · Moderate
The least number of temporary variables required to create a three-address code in static single assignment form for the expression
q
+
r
/
3
+
s
−
t
∗
5
+
u
∗
v
/
w
q + r / 3 + s - t * 5 + u * v / w
q
+
r
/3
+
s
−
t
∗
5
+
u
∗
v
/
w
is ____.
53
CS 2015 Set 2 · 1 mark · MCQ · Moderate
Match the following:
54
CS 2015 Set 2 · 1 mark · MCQ · Moderate
In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
55
CS 2015 Set 2 · 2 marks · MCQ · Moderate
Consider the intermediate code given below.
56
CS 2015 Set 3 · 1 mark · MCQ · Moderate
Among simple LR (SLR) , canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful , in that order?
57
CS 2015 Set 3 · 2 marks · MCQ · Moderate
Consider the following grammar
G
G
G