Compiler Design MCQs - Unit 5
A
code motion
B
loop unrolling
C
inlining
D
constant folding
Correct Answer
constant folding
A
that executes most often
B
that is inside a loop
C
that has comments
D
whose result is never used
Correct Answer
whose result is never used
A
adds extra computation
B
removes all variables
C
adds more loops
D
avoids recomputing an expression whose value is already available
Correct Answer
avoids recomputing an expression whose value is already available
A
x = y + 1
B
y = x + x
C
x = y
D
x = 5
Correct Answer
x = y
A
constant folding
B
dead-code elimination
C
code motion
D
copy propagation
Correct Answer
code motion
A
dead variables
B
induction variables (strength reduction)
C
global variables only
D
labels
Correct Answer
induction variables (strength reduction)
A
scan the input
B
generate tokens
C
link object files
D
collect information about the values at various points in a program
Correct Answer
collect information about the values at various points in a program
A
forward data-flow problem
B
backward data-flow problem
C
lexical problem
D
parsing problem
Correct Answer
forward data-flow problem
A
forward data-flow problem
B
lexical problem
C
backward data-flow problem
D
linking problem
Correct Answer
backward data-flow problem
A
union
B
difference
C
intersection
D
concatenation
Correct Answer
intersection
A
intersection
B
union
C
difference
D
complement
Correct Answer
union
A
OUT[B] = GEN[B] ∪ (IN[B] − KILL[B])
B
OUT[B] = GEN[B] ∩ KILL[B]
C
OUT[B] = IN[B] − GEN[B]
D
OUT[B] = KILL[B]
Correct Answer
OUT[B] = GEN[B] ∪ (IN[B] − KILL[B])
A
transfer functions
B
tokens
C
registers
D
labels
Correct Answer
transfer functions
A
removes all constants
B
adds new constants
C
replaces a variable by its constant value when the value is known
D
renames all variables
Correct Answer
replaces a variable by its constant value when the value is known
A
some but not all paths
B
no paths
C
every path only
D
the stack only
Correct Answer
some but not all paths
A
leader
B
sentinel
C
header
D
handle
Correct Answer
header
A
d is the last node
B
d has no successors
C
n is a leaf only
D
every path from the entry to n goes through d
Correct Answer
every path from the entry to n goes through d
A
b dominates a
B
a dominates b only
C
a and b are the same node only
D
b is a leaf
Correct Answer
b dominates a
A
forward edge
B
leader
C
back edge
D
token
Correct Answer
back edge
A
changes in every iteration
B
does not change during the execution of the loop
C
is always zero
D
is stored in the heap
Correct Answer
does not change during the execution of the loop
A
intermediate code
B
the lexical analyzer
C
the object file
D
the linker script
Correct Answer
intermediate code
A
the first iteration finishes
B
memory is full
C
no further change occurs (a fixed point is reached)
D
the user stops them
Correct Answer
no further change occurs (a fixed point is reached)
A
computing invariant expressions once outside the loop
B
computing them in every iteration
C
removing the loop condition
D
adding more branches
Correct Answer
computing invariant expressions once outside the loop
A
is computed on at least one path only
B
is never used
C
is a constant
D
has been computed on every path to that point and not killed since
Correct Answer
has been computed on every path to that point and not killed since
A
ambiguous
B
reducible
C
irreducible only
D
cyclic only
Correct Answer
reducible
Fill in the Blanks
26
Evaluating constant expressions at compile time is called constant ______.
Correct Answer
folding
27
Code whose result is never used is called ______ code.
Correct Answer
dead
28
Moving a loop-invariant computation out of a loop is called code ______.
Correct Answer
motion
29
The meet operator for reaching definitions is ______.
Correct Answer
union
30
The meet operator for available expressions is ______.
Correct Answer
intersection
31
Live-variable analysis is a ______ data-flow problem.
Correct Answer
backward
32
In the equation OUT[B] = GEN[B] ∪ (IN[B] − ______[B]), the missing term is the set of killed definitions.
Correct Answer
KILL
33
Iterative data-flow algorithms stop when a ______ point is reached.
Correct Answer
fixed
34
Constant propagation replaces a variable by its known constant ______.
Correct Answer
value
35
Partial-redundancy elimination removes expressions that are redundant along ______ paths.
Correct Answer
some
36
A node d ______ a node n if every path from the entry to n passes through d.
Correct Answer
dominates
37
An edge a → b whose head b dominates its tail a is called a ______ edge.
Correct Answer
back
38
A back edge defines a ______ loop.
Correct Answer
natural
39
The single entry node of a loop is called the loop ______.
Correct Answer
header
40
After the statement x = y, copy propagation replaces uses of x by ______.
Correct Answer
y