Compiler translates the source code
Executable code
Machine code
Binary code
Assembly code
Which phase of compiler generate tokens.
Syntax analyzer
Intermediate Code generation
Lexical analyzer
Semantic analyzer
Compiler should report the presence of ___________ in the source program in translation process
Classes
Objects
Errors
Text
What is the output of lexical analyzer
Parse tree
A list of tokens
Intermediate code
Machine code
How many phases of compiler are there?
1
2
4
8
Indicate which of the following is not true about interpreter
Interpreter generates an object program from the source program
Interpreter analyses each source statement every time it is to be executed
Interpreter is a kind of translator
Interpreter is similar to compiler
Which of the following is not a feature of compiler
Scans the entire program first and then translate it into machine code
When all the syntax errors are removed execution takes place
Slow for debugging
Execution time is more
Which of the following is used for grouping of characters into tokens(in a computer)
A Parser
Code Optimizer
Code generator
Scanner
Which data structure in a compiler is used for managing information about variables and their attributes
Abstract Syntax tree
Symbol table
Semantic stack
Parse table
In a compiler,keywords of a language are recognized during
Parsing of the program
Code generation
The lexical analysis of the program
Dataflow analysis
The Linker
Issimilarto interpreter
Uses source code as its object
Is required to create a load module
Is similar to compiler
A compiler that runs on one machine and produces code for different machine is called
Cross compilation
One pass compilation
Two pass compilation
Multi pass compilation
Task of the lexical analysis
To parse the source program into the basic elements
To build a literal table and an identifier table
To build a uniform symbol table
To build a data structure
______________ is a graph representation of a derivation
The parse tree
The Oct tree
The binary tree
The AVL tree
The _________________ is a special character that cannot be part of the source program
Sentinel
Lexeme begin
Forward pointer
Reversepointer
The function ______________ examines the symbol table entry for the lexeme found and
return whatever token name of the symbol table
gettoken()
getid()
installID()
The number of tokens in the following C statement is
printf("i=%d,&i=%x",i,&i);
3
26
10
21
Relocation bits used by the relocating loader are specified by
Relocating loader itself
Linker
Assembler
Macro processor
Compiler can check__________ errors
Logical
Syntax
Content
Semantic
Grammer of the programming is checked at _____________ phase of the compiler
Semanticanalysis
Code optimization
Syntax analysis
code generation
A top down parser generates
RMD
RMD in reverse
LMD
LMD in reverse
YACC builds up
SLRParsingTable
Canonical LR Parsing Table
LALR Parsing Table
LL(1) Parsing Table
Recursive descent parsing is an example of
Top down parsing
Bottom up parser
Predictive parsing
LALR Parsing Table
An Operator precedence parsing, precedence relations are defined
For all pair of non terminals
For all pairs of terminals
To delimit the handle
Only for a certain pair of terminals
Bottom up parsing involves ?
Shift reduce
Handle pruning
Operator check
Reduce reduce
Yacc resolves conflicts by of type ?
Reduce - Reduce
Shift reduce
Shift - Shift
Shift reduce shift
Which of the following parser is most powerful?
Operator precedence
Canonical LR
LALR
SLR
Which of the following actions an operator precedence parser may take to recover from an error?
Insert symbols onto the stack
Delete symbols from the stack
Insert or delete symbols from the input
Push onto the stack
Shift reduce parsers are?
Top down parser
Bottom up parser
May be top down or bottom up parser
SLR Parser
Consider the grammar: S -> L= R | R
L ->* R | id
R -> L
Which of the following set of LR (0) items definitely does not represent a valid state
of an LR (0) parser?
S-> L =∙R, R -> ∙L
L -> id.
S -> L∙ = R, R -> L∙
R -> L∙
Which of the following statements is false?
An unambiguous grammar has same leftmost and rightmost derivation
An LL(1) parser is a top-down parser
LALR is more powerful than SLR
An ambiguous can never be LR(k) for any k
Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states.
The relationship between n1 and n2 is
n1 is necessarily less than n2
n1 is necessarily equal to n2
n1 is necessarily greater than n2
n1 is upper than n2
Consider the grammar:
E ->E + n | E × n | n
For a sentence n + n × n, the handles in the right-sentential form of the reduction
are:
n, E + n and E + n × n
n, E + n and E + E × n
n, n + n and n + n × n
n, E + n and E × n
Consider the grammar shown below: S -> C C C ->c C | d The grammar is
LL (1)
SLR (1) but not LL (1)
LALR (1) but not SLR (1)
LR (1) but not LALR (1)
The grammar S-> aSa | bS | c is
LL(1) but not LR(1)
LR (1) but not LL(1)
Both LL(1) and LR(1)
Neither LL(1) nor LR(1)
YACC is related to
Code generation
Parsing
Lexical Analysis
Semantic Analysis
The collection of ________items is called ‘C’.
LR
LR(1)
LL(1)
Parsing
Multiple defined entries in SLR parsing table is not_________
LR(0)
LR(1)
SLR(0)
SLR(1)
Which of the following conflicts cannot arise in LR PARSING?
Shift-reduce
reduce-reduce
shift-shift
Left recursion
If a grammar is LALR (1) then it is necessarily____________
SLR(1)
CLR(1)/LR(1)
LL(1)
LALR (1) but not SLR (1)
Any transcription error can be repaired by_____________
Deletion alone
insertion and deletion alone
replacement alone
insertion alone
In bottom up parsing shift always_______
pushes a token and also advances the input
does pop operation
advances the input
Pushes a token
______________is the bottom up parser.
Shift reduce parser
Predictive parser
Both
SLR(1)
Datastructure in a compiler is used for managing information about variables and their attributes.
Abstract Syntax Tree
Symbol Table
Semantic stack
Parse table
when is typechecking usually done.
During Syntax Directed Translation
During Lexical Analysis
During Code Optimization
During Syntax Analysis
A tree that shows values of each attributes.
Syntax tree
DAG
Annotated Parse Tree
Parse tree
Three Address code Consists of
Two operand and one result
One operand and two operators
Two operands and operator
One operator and two operators
Listing pointers to triples,rather than listing triples themselves is impleentation of
Quadruple
Triple
Indirect Triple
Three Address Code
Quadruple is record structure with four fields.
op1,arg1,arg2,result
op1,op2,arg2,result
arg1,arg2,result,op
arg1,result,op,arg2
operationschecks if there is an entry for occurrence of the name in the symbol table.
Lookup(id.name)
search(id.name)
Lookup(name)
lookup(id)
Three Address statement is an abstract form of
source program
Machine code
Intermediate Code
Target Program
One of the purposes of using Intermediate code in compilers is to
Make parsing and Semantic analysis simpler
Develop error recovery and error reporting.
Increase the chances of reusing the machine independent code optimizer in another compiler
Improve the register allocation.
SDD
Syntax Directed Definition
Syntax Directed Derivation
Syntax Distributed Definition
Semantic Directed Definition
SDT
Syntax Directed Translation
Semantic Directed Translation
Syntax Distributed Terminal
Semantic Directed Translation
area useful tool for determining an Evaluation order for the attribute instances in a given parse tree.
Dependency Graph
Symbol Table
Parse Table
Semantic Stack
Attributes depend only on the attributes values of children nodes
Inherited Attributes
Synthesized Attributes
S-attributed
L-attributed
Attributes are the ones that depend on parent and/or sibling attributes
Inherited Attributes
Synthesized Attributes
Left child
Right child
The syntax Directed translation scheme is used to execute the order ofrules.
Syntax
Semantic
Evaluation
Execution
In Translation Scheme ,the semantic rules are embedded with in theof the production
curly braces
closed braces
Brackets
commas
Incode ,Boolean operators &&,||,and! Translate into jumps
short circuit
conditional
logic
Flow
can be used to generate code for boolen expressions and flow of control statements in one pass.
Backpatching
Symbol Table
Semantic stack
Hash tables
DAG
Directed Acyclic Graph
Directed Accronym Graph
Definited Acyclic Graph
Directed Acyclic Group
The Three Address Code Can be represendted Informs
one
two
four
three
Heap and Stack Memeory utilization type is ________
union
Dynamic
Static
stack
the stack is used to store data called _____________
frames
activation records
activation tree
control stack
we can represent the activations of procedures during the running of entire program by a tree called as_________
control link
activation tree
frames
control stack
___________divides the a portion of an array
pointer
linker
partition
frame
the sequence of procedure calls corresoponds to a preoorder traversal of the _________
basic blocks
frames
activation tree
DST
procedure calls and returns are usually manged by a run time stack called the ______
activation tree
control stack
DST
frames
actovation records some times we can called as ___________
activation tree
control stack
DST
frames
a_____________ pointing the activation record of the caller
control link
pointer
stack pointer
heap pointer
global variable are allocated________________ storage
heap
static
dynamic
stack
the memory manager keeps the track of all t he free space in ______________at all times
stack
heap
union
classs
stack based architectures were revived with the introduction of ___________
C Compiler
VB Compiler
JVM
Cobol compiler
___________________algorithms seek to minimize the sum of the costs of the instructions executed by generated target program
Good code generation
liva variable
iterative algorithm
semilattices
the size of the target code can be determined at _________________
run time
compile time
program save time
memory occupation time
the flow of control can only enter the basic block through the _____________________instruction in the block
second
last
first
any
the basic blocks become the nodes of a ______________
flow graph
activation record
activation tree
DAG
_______________ is a represention for single expressions
form
DAG
flowgraph
activation tree
we can eliminate the dead code with the help of ____________
DAG
loop optimization
local common sub expression
flow graph
A Simple but effective technique for locally improving the targe code is _____________________
peephole optimization
Intermediate representation
basic block
algebraic elemination
one of the opportunity of Peephole optimization is __________________
removal of unreachable instructions
flow of control optimization
Algeriaic equation
removal of DAG
efficiant utilization of registers is vitally important in generating _____________
good code
exicutable code
loop optimization
machine idioms
basic blocks play an important role in identifying __________
variables
registers
graphs
SDT's
basic blocks in a program can be represented by ___________
Source code
Basic blocks
control flow graph
constant propagation
_____________plays no role in any program operation
induction analysis
SDT's
Basic Blocks
Control flow graph
_________are very imortant place for optimization.
Basic Blocks
Control flow graphs
Loops
Variables
decreases the amount of code in a loop is _______
Code motion
Dead code
Basic block
flow graph
the _________ values before and after a statement are constrained by the semantic of
the statements
Transfer functions
data flow
code motion
control flow
Every control flow graph has ______ empty basic blocks
3
4
5
2
An important use for _____________information is register allocation for basic blocks.
data flow
live varaible
code motion
contrtol flow
A frame work obeys a condition strong than ______________
Monotone framework
distributivity condition
transfer functions
basic block
the paths are considered in the _______________solutions are superset of all paths
meet over path
dataflow
control flow
ideal solution
_____________ framework described is different form all other data flow problems.
constant propogation
distributivity condition
transfer function
code motion
constatn propogation is _______________dataflow
forward
backward
upward
downward
the constant propogation frame work difined is _____________ but not distributive
montone
code motion
mote over path
dataflow
redundancy ____________ forms
1
3
4
2
the lazy code motion algorithm motivates _________algorithm
two step
three step
four step
six step
a usefull way of presentig dominator information is in a tree called ________
dominator tree
DFST
flowgraph
DAG
the route of the search in a deapthfirst search forms a____________
DAG
DFST
Dominator tree
flowgraph tree
most global optimizations are based on ____________
dataflow analysis
flow graph
domionator tree
dead code
wew can use fragment of sorting program called ____________to illustrate several
important code improving transformations.
merge sort
quick sort
selection sort
insertion sort
a varaible is ______________ at apoint in a program if its value can be used subsequently.
dead
live
error
unit