Compiler Design MCQs - Unit 4
A
the entire source program
B
the symbol table
C
only global variables
D
information needed for a single execution of a procedure
Correct Answer
information needed for a single execution of a procedure
A
pushed on a procedure call and popped on return
B
stored in the heap
C
never removed
D
stored in the source file
Correct Answer
pushed on a procedure call and popped on return
A
the heap
B
the activation record of the caller
C
the next instruction
D
the global data
Correct Answer
the activation record of the caller
A
return a value
B
reach nonlocal data under static scoping
C
store temporaries
D
save registers
Correct Answer
reach nonlocal data under static scoping
A
a list of tokens
B
a type of register
C
an array of pointers to activation records used for nonlocal access
D
a screen buffer
Correct Answer
an array of pointers to activation records used for nonlocal access
A
dynamically allocated data whose lifetime is not tied to a procedure
B
only local variables
C
only return addresses
D
only constants
Correct Answer
dynamically allocated data whose lifetime is not tied to a procedure
A
memory that is not yet allocated
B
memory that has already been freed
C
a register
D
the stack top
Correct Answer
memory that has already been freed
A
memory is freed twice
B
the stack overflows
C
allocated memory is never freed and cannot be reached
D
a pointer is null
Correct Answer
allocated memory is never freed and cannot be reached
A
reclamation of memory that is no longer reachable
B
compilation of programs
C
creation of tokens
D
allocation of registers
Correct Answer
reclamation of memory that is no longer reachable
A
all garbage
B
cyclic garbage
C
any stack data
D
constants
Correct Answer
cyclic garbage
A
marks all reachable objects and then sweeps the unmarked ones
B
deletes everything and restarts
C
sorts the objects by size
D
compiles the objects
Correct Answer
marks all reachable objects and then sweeps the unmarked ones
A
leaf set
B
root set
C
free list
D
symbol table
Correct Answer
root set
A
a single entry and a single exit
B
many entries and one exit
C
one entry and many exits
D
no entry
Correct Answer
a single entry and a single exit
A
header
B
leader
C
handle
D
sentinel
Correct Answer
leader
A
tokens
B
basic blocks
C
registers
D
variables
Correct Answer
basic blocks
A
eliminating common subexpressions
B
adding new loops
C
increasing code size
D
scanning tokens
Correct Answer
eliminating common subexpressions
A
the entire program at once
B
only the symbol table
C
a small window of target instructions
D
only comments
Correct Answer
a small window of target instructions
A
Adding more variables
B
Increasing loop count
C
Removing the main function
D
Eliminating redundant loads and stores
Correct Answer
Eliminating redundant loads and stores
A
binary search
B
hashing only
C
graph coloring
D
tokenising
Correct Answer
graph coloring
A
Instruction selection
B
Lexeme counting
C
Comment removal
D
Token naming
Correct Answer
Instruction selection
A
strength reduction
B
dead-code elimination
C
loop unrolling
D
constant folding
Correct Answer
strength reduction
A
register spilling
B
backpatching
C
inlining
D
algebraic simplification
Correct Answer
algebraic simplification
A
expression trees
B
lexical analysis
C
string matching
D
linking
Correct Answer
expression trees
A
the source comments
B
the token list only
C
the object file
D
the symbol table
Correct Answer
the symbol table
A
the frame (stack) pointer
B
the heap base only
C
the program counter only
D
the file pointer
Correct Answer
the frame (stack) pointer
Fill in the Blanks
26
An ______ record stores the information needed for one execution of a procedure.
Correct Answer
activation
27
The ______ link in an activation record points to the caller's activation record.
Correct Answer
control
28
The ______ link is used to access nonlocal data under static scoping.
Correct Answer
access
29
Dynamically allocated data with an unknown lifetime is stored in the ______.
Correct Answer
heap
30
A pointer to memory that has already been freed is called a ______ pointer.
Correct Answer
dangling
31
Reference counting cannot reclaim ______ structures.
Correct Answer
cyclic
32
Mark-and-sweep garbage collection has two phases: mark and ______.
Correct Answer
sweep
33
A basic block has a single entry and a single ______.
Correct Answer
exit
34
The first statement of a basic block is called a ______.
Correct Answer
leader
35
In a flow graph, the nodes are ______.
Correct Answer
basic blocks
36
Peephole optimization examines a small ______ of instructions.
Correct Answer
window
37
Strength reduction replaces expensive operations with ______ ones.
Correct Answer
cheaper
38
Register allocation can be done using graph ______.
Correct Answer
coloring
39
A DAG helps in common ______ elimination within a basic block.
Correct Answer
subexpression
40
Replacing x * 8 with x << 3 is an example of ______ reduction.
Correct Answer
strength