0% found this document useful (0 votes)
243 views

Compiler Mcqs Last Updated Solved Complete

The document contains questions about compiler design topics such as code optimization techniques, parsing, semantic analysis, code generation, and runtime concepts. Specifically, it asks multiple choice questions about types of optimization, loop optimization techniques, parsing approaches, attribute grammar, semantic analysis tasks, procedure calls, activation records, and variable scope. The questions cover foundational as well as advanced concepts in compiler design.

Uploaded by

saeed khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
243 views

Compiler Mcqs Last Updated Solved Complete

The document contains questions about compiler design topics such as code optimization techniques, parsing, semantic analysis, code generation, and runtime concepts. Specifically, it asks multiple choice questions about types of optimization, loop optimization techniques, parsing approaches, attribute grammar, semantic analysis tasks, procedure calls, activation records, and variable scope. The questions cover foundational as well as advanced concepts in compiler design.

Uploaded by

saeed khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

1. Optimization can be categorized broadly into ____ types.

A. 2

B. 3

C. 4

D. 5

2. A fragment of code that resides in the loop and computes the same value at each iteration is called a?

A. Induction analysis

B. Strength reduction

C. loop-invariant code

D. None of the above

3. A variable is called an _________ variable if its value is altered within the loop by a loop-invariant
value.

A. Invariant

B. induction

C. strength

D. loop

4. Dead code plays no role in any program operation and therefore it can simply be eliminated.

A. TRUE

B. FALSE

C. Can be true or false

D. Can not say

5. Substitution of values for names whose values are constant, is done in

A. local optimization

B. loop optimization

C. constant folding

D. None of the above


6. Peep-hole optimization is a form of

A. loop optimization

B. local optimization

C. data flow analysis

D. constant folding

7. In analyzing the compilation of PL/I program, the term Machine independent optimization is
associated with

A. creation of more optical matrix

B. recognition of basic elements and creation of uniform symbols

C. recognization of basic syntactic construction through reductionsc

D. use of macro-processor to produce more optimal assembly code

8. Before generating intermediate code, the compiler can modify the intermediate code by address
calculations and improving loops.

A. TRUE

B. FALSE

C. Can be true or false

D. Cannot say

9. The compiler can make use of memory hierarchy and CPU registers.

A. TRUE

B. FALSE

C. Can be true or false

D. Cannot say

10. A compiler for a high-level language that runs on one machine and produces code for a different
machine is called

A. optimizing compiler

B. one pass compiler

C. cross compiler

D. multipass compiler
1. In how many types parsing is divided?

A. 2

B. 3

C. 4

D. 5

2. When the parser starts constructing the parse tree from the start symbol and then tries to transform
the start symbol to the input, it is called?

A. bottom-up parsing

B. top-down parsing

C. Both A and B

D. None of the above

3. In ___________________, if one derivation of a production fails, the syntax analyzer restarts the
process using different rules of same production

A. Bottom-up Parsing

B. Recursive descent parsing

C. Backtracking

D. All of the above

4. A form of recursive-descent parsing that does not require any back-tracking is known as?

A. predictive parsing

B. non-predictive parsing

C. recursive parsing

D. non-recursive parsing

5. Compute E.value for the root of the parse tree for the expression:2 # 3 & 5 # 6 &4.

A. 40

B. 80

C. 120

D. 160

6. Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states.
A. n1 is necessarily less than n2

B. n1 is necessarily equal to n2

C. n1 is necessarily greater than n2

D. None of the above

7. the predictive parser puts some constraints on the grammar and accepts only a class of grammar
known as LL(k) grammar.

A. TRUE

B. FALSE

C. Can be true or false

D. Can not say

8. Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

A. Removing left recursion only

B. Factoring the grammar alone

C. Factoring & left recursion removal

D. None of the above

9. Which of the following derivations does a top-down parser use while parsing an input string?

A. Leftmost derivation

B. Leftmost derivation in reverse

C. Rightmost derivation

D. Rightmost derivation in reverse

10. Relocation is the process of replacing symbolic references or names of libraries with actual usable
addresses in memory before running a program.

A. TRUE

B. FALSE

C. Can be true or false

D. Can not say


1. Lexical analysis is the _______ phase of a compiler

A. first

B. second

C. third

D. fourth

2. lexical analyzer is used to ?

A. remove whitespace

B. removing comments

C. breaks these syntaxes into a series of tokens

D. All of the above

3. If the lexical analyzer finds a token invalid then?

A. it generates an exception

B. it generates an warning

C. it generates an error

D. reads the whole program

4. When the lexical analyzer read the source-code, it scans the code?

A. line by line

B. word by word

C. letter by letter

D. reads the whole program

5. Which tool/computer program for generating lexical analyzers (scanners or lexers) written by Vern
Paxson in C around 1987?

A. FLEX

B. GLEX

C. CLEX

D. SLEX

Ans : A
Explanation: FLEX (fast lexical analyzer generator) is a tool/computer program for generating lexical
analyzers (scanners or lexers) written by Vern Paxson in C around 1987.

6. The function ________ is automatically generated by the flex when it is provided with a .l file

A. flex()

B. yylex()

C. lex()

D. nnlex()

7. In the input file, In which section Anything written in this brackets is copied directly to the file
lex.yy.c?

A. Rules Section

B. Definition Section

C. User Code Section

D. None of the above

8. The rule section is enclosed in?

A. %%

B. $$

C. %%%%

D. $$$$

9. Which symbol table implementation is based on the property of locality of reference?

A. Linear list

B. Search tree

C. Hash Table

D. Self Organisation

10. System program such a compiler are designed so that they are ________

A. Re-enterable

B. Non-Usable

C. Serially usable
D. None of the above

1. How many components context-free grammar has?

A. 2

B. 3

C. 4

D. 5

2. A set of tokens, known as?

A. non-terminals

B. terminal symbols

C. productions

D. start symbol

3. Which of the following called left side of the production?

A. production consists of a non-terminal

B. sequence of tokens and/or on- terminals

C. Both A and B

D. None of the above

4. Which of the following is a graphical depiction of a derivation?

A. Derivation Tree

B. Analyzers Tree

C. Parse Tree

D. Ambiguity Tree

5. In parse tree, leaf nodes are called?

A. terminals

B. non-terminals

C. sub-terminals

D. half-terminals

6. Which of the following are Limitations of Syntax Analyzers?


A. it cannot determine if a token is valid,

B. it cannot determine if a token is declared before it is being used,

C. it cannot determine if an operation performed on a token type is valid or not.

D. All of the above

7. How many types of parsing are there?

A. 2

B. 3

C. 4

D. 5

8. When the parser starts constructing the parse tree from the start symbol and then tries to transform
the start symbol to the input, it is called?

A. Recursive descent parsing

B. Backtracking

C. Top-down Parsing

D. Bottom-up Parsing

9. Type checking is normally done during ____________

A. Lexical Analysis

B. Syntax Analysis

C. Syntax Directed Translation

D. Code generation

10. Which of the following is true?

A. In Short Syntax Analysis Generates Parse Tree.

B. Syntax analyser does not check the type of the operand.

C. Symbol table is created by the compiler which contains the list of lexemes or tokens.

D. All of the above


1. What is true about Syntax Directed Definitions?

A. Syntax Directed Definitions + Semantic rules = CFG

B. Syntax Directed Definitions + CFG = Semantic rules

C. CFG + Semantic rules = Syntax Directed Definitions

D. None of the above

2. Which of the following error is expected to recognize by semantic analyzer?

A. Type mismatch

B. Undeclared variable

C. Reserved identifier misuse.

D. All of the above

3. ____________ is a medium to provide semantics to the context-free grammar

A. Domain grammer

B. Attribute grammar

C. Object grammar

D. Value grammer

4. Semantic analyzer attaches attribute information with AST, which are called?

A. Analyzer attribute

B. Attributed AST

C. Analyzer AST

D. AST

5. Which attributes get values from the attribute values of their child nodes?

A. Synthesized attributes

B. Inherited attributes

C. S-attributed SDT

D. L-attributed SDT

6. Which form of SDT uses both synthesized and inherited attributes with restriction of not taking values
from right siblings?

A. T-attributed SDT

B. A-attributed SDT
C. S-attributed SDT

D. L-attributed SDT

7. If an SDT uses only synthesized attributes, it is called as?

A. T-attributed SDT

B. A-attributed SDT

C. S-attributed SDT

D. R-attributed SDT

8. Which of the following tasks should be performed in semantic analysis?

A. Scope resolution

B. Type checking

C. Array-bound checking

D. All of the above

9. What is meant by compositional semantics?

A. Determining the meaning

B. Logical connectives

C. Semantics

D. All of the above

10. What is true about Attribute Grammar?

A. Attribute grammar is a special form of context-free grammar

B. Each attribute has well-defined domain of values

C. The right part of the CFG contains the semantic rules

D. All of the above

1. Which of the following known as the text part of a program that does not change at runtime. Its
memory requirements are known at the compile time?

A. Code

B. Procedures

C. Variables

D. All of the above


2. A procedure has a start and an end delimiter and everything inside it is called the body of the
procedure.

A. TRUE

B. FALSE

C. A procedure has a start with delimiter but not end with delimiter.

D. A procedure has a not start with delimiter but end with delimiter.

3. In activation record, Which of the following Stores the address of activation record of the caller
procedure?

A. Access Link

B. Actual Parameters

C. Control Link

D. Temporaries

4. Whenever a procedure is executed, its activation record is stored on the stack, also known as?

A. Access Stack

B. Control stack

C. Formal Stack

D. Return Stack

5. _________ are known at the runtime only, unless they are global or constant.

A. values

B. Object

C. Variables

D. All of the above

6. The location of memory (address) where an expression is stored is known?

A. r-value

B. k-value

C. l-value

D. t-value

7. What is true about Formal Parameters?

A. These variables are declared in the definition of the called function.


B. These variables are specified in the function call as arguments.

C. Variables whose values or addresses are being passed to the called procedure are called Formal
Parameter.

D. All of the above

8. In which mechanism, the calling procedure passes the r-value of actual parameters and the compiler
puts that into the called procedure’s activation record?

A. Pass by Reference

B. Pass by Name

C. Pass by Copy-restore

D. Pass by Value

9. In which mechanism, the name of the procedure being called is replaced by its actual body?

A. Pass by Reference

B. Pass by Name

C. Pass by Copy-restore

D. Pass by Object

10. What will be error?

7 = x + y;

A. l-value error

B. r-value error

C. Infinite loop

D. Both A and B

1. Code generation can be considered as the?

A. first phase of compilation

B. second phase of compilation

C. third phase of compilation

D. final phase of compilation

2. ___________ is a tool that depicts the structure of basic blocks, helps to see the flow of values
flowing among the basic blocks, and offers optimization too.
A. DAG

B. CAG

C. SAG

D. PAG

Explanation: Directed Acyclic Graph (DAG) is a tool that depicts the structure of basic blocks, helps to
see the flow of values flowing among the basic blocks, and offers optimization too.

3. In Directed Acyclic Graph, Leaf nodes represent?

A. identifiers

B. names

C. constants

D. All of the above

4. In Algebraic expression simplification, a = a + 1 can simply be replaced by?

A. a

B. INC a

C. DEC a

D. MUL a

5. x * 2 can be replaced by x << 1 is an example of?

A. Algebraic expression simplification

B. Accessing machine instructions

C. Strength reduction

D. Code Generator

6. The following code is an example of?

void add_ten(int x)

return x + 10;

printf(""value of x is %d"", x);


}

A. Redundant instruction elimination

B. Unreachable code

C. Flow of control optimization

D. None of the above

7. How many descriptors are used for track both the registers (for availability) and addresses (location of
values) while generating the code?

A. 2

B. 3

C. 4

D. 5

8. __________ are used to keep track of memory locations where the values of identifiers are stored.

A. Register descriptor

B. Address descriptor

C. Both A and B

D. None of the above

9. Code generator uses ______ function to determine the status of available registers and the location
of name values.

A. setReg

B. cinReg

C. pfReg

D. getReg

10. Which of the following is not a form of Intermediate representation?

A. Abstract Syntax Tree

B. 3-address code

C. Directed cyclic Graph

D. Reverse Polish Notation

1. How many alphabets are there in Binary language?


A. 2

B. 3

C. 4

D. 5

2. we write programs in?

A. Low-Level Language

B. Middle-Level Language

C. High-Level Language

D. Decimal-Format

3. _______ is a program that converts high-level language to assembly language.

A. assembler

B. compiler

C. interpreter

D. linker

4. A compiler that runs on platform (A) and is capable of generating executable code for platform (B) is
called ?

A. cross-compiler

B. complex-compiler

C. object-compiler

D. post-compiler

5. Which of the following is used to link all the parts of the program together for execution?

A. loader

B. linker

C. memory

D. preprocessor

6. Which of the following tool produces input for compilers?

A. Interpreter

B. Assembler
C. Loader

D. Preprocessor

7. Does compiler reads the whole source code at once?

A. Yes

B. No

C. Depends on compiler

D. Don't know

8. If an error occurs, what interpreter do?

A. terminate program

B. stops execution

C. reads the whole program even if it encounters errors

D. give warning

9. If an error occurs, what compiler do?

A. terminate program

B. stops execution

C. reads the whole program even if it encounters errors

D. give warning

10. The output of an assembler is called?

A. data file

B. task file

C. object file

D. program file

1. In finite automata, Q stands for?

A. Finite set of input symbols

B. Transition function

C. Finite set of states

D. One Start state

2. Final state is represented by?

A. Square
B. Circle

C. Double Circle

D. Rhombus

3. _________ of FA are represented by circles

A. States

B. Start state

C. Intermediate states

D. Transition

4. How many arrow does intermediate states have?

A. 1

B. 2

C. 3

D. 4

5. In Final state, The number of odd arrows are one greater than even, i.e. odd = even+1?

A. TRUE

B. FALSE

C. Can be true or false

D. Can not say

6. There are ________ tuples in finite state machine

A. 3

B. 4

C. 5

D. 6

7. Number of states require to accept string ends with 10.

A. 0

B. 1

C. 2

D. 3

8. Languages of a automata is
A. If it halts

B. If it is accepted by automata

C. If automata touch final state in its life time

D. All language are language of automata

9. Language of finite automata is

A. Type 0

B. Type 1

C. Type 2

D. Type 3

10. The basic limitation of finite automata is that

A. it can’t remember arbitrary large amount of information

B. it sometimes recognize grammar that are not regular

C. it sometimes fails to recognize regular grammar

D. None of the above

1. The grammar defined by regular expressions is known as?

A. regular language

B. regular grammar

C. regular notations

D. regular operation

2. The language defined by regular grammar is known as?

A. regular language

B. regular grammar

C. regular notations

D. regular operation

3. Union of two languages L and M is written as?

A. LM = {st | s is in L and t is in M}

B. L+M

C. L*M

D. L U M = {s | s is in L or s is in M}
4. Concatenation (.) has the ________ highest precedence

A. first

B. second

C. third

D. fourth

View Answer

5. Which of them are not left associative?

A. *

B. |

C. plus(+)

D. .

6. The RE in which any number of 0′s is followed by any number of 1′s followed by any number of 2′s is?

A. (0+1+2)*

B. 0*1*2*

C. 0* + 1 + 2

D. (0+1)*2*

7. Which of the following is NOT the set of regular expression R = (ab + abb)* bbab?

A. ababbbbab

B. abbbab

C. ababbabbbab

D. abababab

8. Consider the production of the grammar S->AA A->aa A->bb Describe the language specified by the
production grammar.

A. L = {aaaa,aabb,bbaa,bbbb}

B. L = {abab,abaa,aaab,baaa}

C. L = {aaab,baba,bbaa,bbbb}

D. L = {aaaa,abab,bbaa,aaab}

9. If R is regular language and Q is any language (regular/ non regular), then Pref (Q in R) is
_____________
A. Non-regular

B. Equal

C. Infinite

D. Regular

10. The non terminal that gives null will said to have a null production

A. TRUE

B. FALSE

C. Can be true or false

D. Can not say


The output of lexical analyzer is

A set of regular expressions


Syntax tree
Set of tokens
Strings of character
_____________________________________________________________________________________
If conversion from one type to another type is done automatically by the compiler then,it is called

Implicit conversion
Coercions
both a and b
None of the above
_____________________________________________________________________________________
Syntax directed translation scheme is desirable because

It is based on the syntax


Its description is independent of any implementation
It is easy to modify
All of these
_____________________________________________________________________________________
A top down parser generates

Right most derivation


Right most derivation in reverse
Left most derivation
Left most derivation in reverse
_____________________________________________________________________________________
Macro-processors are ______

Hardware
Compiler
Registers
None of the above
_____________________________________________________________________________________
Inherited attribute is a natural choice in

Keeping track of variable declaration


Checking for the correct use of L values and R values
Both A and B
None of these
_____________________________________________________________________________________
Concept which can be used to identify loops is

Dominators
Reducible graphs
Depth first ordering
All of these
_____________________________________________________________________________________
Reduction in strength means

Replacing run time computation by compile time computation


Removing loop invariant computation
Removing common sub expression
Replacing a costly operation by a relatively cheaper one
_____________________________________________________________________________________
the term environment in programming language semantics is said as

function that maps a name to value held there


Function that maps a name to storage location
The functin that maps a storage location to the value held there
None of the above
_____________________________________________________________________________________
A self relocating program is one which

cannot be made to execute in any area of storage other than the designated for it at the time of its coding
or translation
Consists of a program and relevant information for its relocation
Can itself perform the relocation of its address sensitive protions
All of the above
_____________________________________________________________________________________
The lexical analyzer takes_________as input and produces a stream of_______as output.

Source program,tokens
Token,source program
Either A and B
None of the above
_____________________________________________________________________________________
Intermediate code generation phase gets input from
Lexical analyzer
Syntax analyzer
Semantic analyzer
Error handling
_____________________________________________________________________________________
A grammar is meaningless

If terminal set and non terminal set are not disjoint


If left hand side of a production is a single terminal
If left hand side of a production has no non terminal
All of these
_____________________________________________________________________________________
The optimization technique which is typically applied on loops is

Removal of invariant computation


Peephole optimization
Constant folding
All of these
_____________________________________________________________________________________
resolution is externally defined symbols is performed by

linker
loader
compiler
assembler
_____________________________________________________________________________________
Which of the following is used for grouping of characters into tokens?

Parser
Code optimization
Code generator
Lexical analyzer
_____________________________________________________________________________________
Whether a given pattern constitutes a token or not depends on the

Source language
Target language
Compiler
All of these
_____________________________________________________________________________________
A optimizing compiler

Is optimized to occupy less space


Is optimized to take less time for execution
Optimized the code
None of the above.
_____________________________________________________________________________________
Which of the following symbols table implementation is based on the property of locality of reference?

Hash table
Search tree
Self organizing list
Linear list
_____________________________________________________________________________________
Three address code involves

Exactly 3 address
At most most 3 address
No unary operators
None of these
_____________________________________________________________________________________

A
B
C
D
_____________________________________________________________________________________
A compiler is

A program that place program into memory and prepares them for execution
A program that automates the translation of assembly language into machine language
program that accepts program written in high level language and produces an object program
A program that appears to execute a source program as if it were machine language
_____________________________________________________________________________________
In a bottom up evaluation of a syntax direction definition ,inherited attributes can

Always be evaluated
Be evaluated only if the definition is L -attributed
Be evaluated only if the definition has synthesized attributes
None of the above
_____________________________________________________________________________________
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
All of the above
_____________________________________________________________________________________
DAG representation of a basic block allows

Automatic detection of local common sub expressions


Automatic detection of induction variables
Automatic detection of loop variant
None of the above
_____________________________________________________________________________________
Recursive descent parsing is an example

Top down parsing


Bottom up parsing
Predictive parsing
None of the above
_____________________________________________________________________________________
The graph that shows basic blocks and their successor relationship is called

DAG
Flow chart
Control graph
Hamiltonian graph
_____________________________________________________________________________________
Generation of intermediate code based on a abstract machine model is useful in compilers because

it makes implementation of lexical analysis and syntax analysis easier


syntax directed translation can be written for intermediate code generation.
It enhances the portability of the front end of the compiler
it is not possible to generate code for real machines directly from high level language programs
_____________________________________________________________________________________
Advantage of panic mode of error recovery is that

It is simple ti implement
It never gets into an infinite loop
Both A and B
None of these
_____________________________________________________________________________________
In operator precedence parsing , precedence relations are defoned

For all pair of non terminals


For all pair of terminals
To delimit the handle
Only for a certain pair of terminals
_____________________________________________________________________________________
An intermediate code form is

Postfix notation
Syntax trees
Three address code
All of these
_____________________________________________________________________________________
Code can be optimized at

Source from user


Target code
Intermediate code
All of the above
_____________________________________________________________________________________
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.
Program main;
Var ...
Procedure A1;
Var ...
Call A2;
End A1
Procedure A2;
Var ...
Procedure A21;
Var ...
Call A1;
End A21
Call A21;
End A2
Call A1;
End main.
Consider the calling chain: Main -> A1 -> A2 -> A21 -> A1
The correct set of activation records along with their access links is given by

A
B
C
D
_____________________________________________________________________________________
Pee hole optimization

Loop optimization
Local optimization
Constant folding
Data flow analysis
_____________________________________________________________________________________
In which way(s) a macroprocessor for assembly language can be implemented ?

Independent two-pass processor


Independent one-pass processor
Expand macrocalls and substitute arguments
All of the above
_____________________________________________________________________________________
A compiler for a high level language that runs on one machine and produce code for different machine is called

Optimizing compiler
One pass compiler
Cross compiler
Multipass compiler
_____________________________________________________________________________________
Which of the following is used for grouping of characters into tokens (in a computer)

A parser
Code optimizer
Code generator
Scanner
_____________________________________________________________________________________
Local and loop optimization in turn provide motivation for

Data flow analysis


Constant folding
Pee hole optimization
DFA and constant folding
_____________________________________________________________________________________
A simple two-pass assembler does which of the following the first phase

It allocates space for the literals.


It computes the total length of the program.
It builds the symbol table for the symbols and their values.
All of above
_____________________________________________________________________________________
the translator is best described as

Application software
A system software
A hardware component
All of the above
_____________________________________________________________________________________
Which of the following is the most powerful parser?

SLR
LALR
Canonical LR
Operator precedence
_____________________________________________________________________________________
Which of the following are language processors?

Assembler
Compilers
interpreters
All of these
_____________________________________________________________________________________
Relocating bits used by relocating loader are specified by

Relocating loader itself


Linker
Assembler
Macro processor
_____________________________________________________________________________________
Synthesized attribute can be easily simulated by a

LL grammar
Ambiguous grammar
LR grammar
None of the above
_____________________________________________________________________________________
A compiler that runs on one machine and produces code for a different machine is called

Cross compilation
One pass compilation
Two pass compilation
None of the above
_____________________________________________________________________________________
_________or scanning is the process where the stream of characters making up the source program is read from left to right and
grouped into tokens.

Lexical analysis
Diversion
Modeling
None of the above
_____________________________________________________________________________________
Input to code generator

Source code
Intermediate code
Target code
All of the above
_____________________________________________________________________________________
In analysis the compilation PL/I program the description Create of more optimal matrix is associated with

Assembly and output


code generation
Syntax analysis
machine independent optimization
_____________________________________________________________________________________
A bottom up parser generates

right most derivation


right most derivation in reverse
left most derivation
left most derivation in reverse
_____________________________________________________________________________________
In an absolute loading scheme which loader function is accomplished by assembler ?

re-allocation
allocation
linking
loading

The output of lexical analyzer is

A set of regular expressions


Syntax tree
Set of tokens
Strings of character

If conversion from one type to another type is done automatically by the compiler then,it is
called

Implicit conversion
coercions
both a and b
None of the above

Syntax directed translation scheme is desirable because

It is based on the syntax


Its description is independent of any implementation
It is easy to modify
All of these

A top down parser generates

Right most derivation


Right most derivation in reverse
Left most derivation
Left most derivation in reverse

Macro-processors are ______

Hardware
Compiler
Registers
None of the above

Inherited attribute is a natural choice in

Keeping track of variable declaration


Checking for the correct use of L values and R values
Both A and B
None of these

Concept which can be used to identify loops is

Dominators
Reducible graphs
Depth first ordering
All of these

Reduction in strength means

Replacing run time computation by compile time computation


Removing loop invariant computation
Removing common sub expression
Replacing a costly operation by a relatively cheaper one

the term environment in programming language semantics is said as

function that maps a name to value held there


Function that maps a name to storage location
The functin that maps a storage location to the value held there
None of the above

A self relocating program is one which

cannot be made to execute in any area of storage other than the designated for it at the time of its
coding or translation
Consists of a program and relevant information for its relocation
Can itself perform the relocation of its address sensitive protions
All of the above

The lexical analyzer takes_________as input and produces a stream of_______as output.

Source program,tokens
Token,source program
Either A and B
None of the above

Intermediate code generation phase gets input from

Lexical analyzer
Syntax analyzer
Semantic analyzer
Error handling
A grammar is meaningless

If terminal set and non terminal set are not disjoint


If left hand side of a production is a single terminal
If left hand side of a production has no non terminal
All of these

The optimization technique which is typically applied on loops is

Removal of invariant computation


Peephole optimization
Constant folding
All of these

resolution is externally defined symbols is performed by

linker
loader
compiler
assembler

Which of the following is used for grouping of characters into tokens?

Parser
Code optimization
Code generator
Lexical analyzer

Whether a given pattern constitutes a token or not depends on the

Source language
Target language
Compiler
All of these

A optimizing compiler

Is optimized to occupy less space


Is optimized to take less time for execution
Optimized the code
None of the above.
______________________________________________________________________________
_______
Which of the following symbols table implementation is based on the property of locality of
reference?

Hash table
Search tree
Self organizing list
Linear list
______________________________________________________________________________
_______
Three address code involves

Exactly 3 address
At most most 3 address
No unary operators
None of these
______________________________________________________________________________
_______

A
B
C
D
______________________________________________________________________________
_______
A compiler is

A program that place program into memory and prepares them for execution
A program that automates the translation of assembly language into machine language
program that accepts program written in high level language and produces an object program
A program that appears to execute a source program as if it were machine language
______________________________________________________________________________
_______
In a bottom up evaluation of a syntax direction definition ,inherited attributes can

Always be evaluated
Be evaluated only if the definition is L -attributed
Be evaluated only if the definition has synthesized attributes
None of the above
______________________________________________________________________________
_______
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
All of the above
______________________________________________________________________________
_______
DAG representation of a basic block allows

Automatic detection of local common sub expressions


Automatic detection of induction variables
Automatic detection of loop variant
None of the above
______________________________________________________________________________
_______
Recursive descent parsing is an example

Top down parsing


Bottom up parsing
Predictive parsing
None of the above
______________________________________________________________________________
_______
The graph that shows basic blocks and their successor relationship is called

DAG
Flow chart
Control graph
Hamiltonian graph
______________________________________________________________________________
_______
Generation of intermediate code based on a abstract machine model is useful in compilers
because

it makes implementation of lexical analysis and syntax analysis easier


syntax directed translation can be written for intermediate code generation.
It enhances the portability of the front end of the compiler
it is not possible to generate code for real machines directly from high level language programs
______________________________________________________________________________
_______
Advantage of panic mode of error recovery is that

It is simple ti implement
It never gets into an infinite loop
Both A and B
None of these
______________________________________________________________________________
_______
In operator precedence parsing , precedence relations are defoned

For all pair of non terminals


For all pair of terminals
To delimit the handle
Only for a certain pair of terminals
______________________________________________________________________________
_______
An intermediate code form is

Postfix notation
Syntax trees
Three address code
All of these
______________________________________________________________________________
_______
Code can be optimized at

Source from user


Target code
Intermediate code
All of the above
______________________________________________________________________________
_______
Consider the program given below, in a block-structured pseudo-language with lexical scoping
and nesting of procedures permitted.
Program main;
Var ...
Procedure A1;
Var ...
Call A2;
End A1
Procedure A2;
Var ...
Procedure A21;
Var ...
Call A1;
End A21
Call A21;
End A2
Call A1;
End main.
Consider the calling chain: Main -> A1 -> A2 -> A21 -> A1
The correct set of activation records along with their access links is given by
A
B
C
D
______________________________________________________________________________
_______
Pee hole optimization

Loop optimization
Local optimization
Constant folding
Data flow analysis
______________________________________________________________________________
_______
In which way(s) a macroprocessor for assembly language can be implemented ?

Independent two-pass processor


Independent one-pass processor
Expand macrocalls and substitute arguments
All of the above
______________________________________________________________________________
_______
A compiler for a high level language that runs on one machine and produce code for different
machine is called

Optimizing compiler
One pass compiler
Cross compiler
Multipass compiler
______________________________________________________________________________
_______
Which of the following is used for grouping of characters into tokens (in a computer)

A parser
Code optimizer
Code generator
Scanner
______________________________________________________________________________
_______
Local and loop optimization in turn provide motivation for

Data flow analysis


Constant folding
Pee hole optimization
DFA and constant folding
______________________________________________________________________________
_______
A simple two-pass assembler does which of the following the first phase

It allocates space for the literals.


It computes the total length of the program.
It builds the symbol table for the symbols and their values.
All of above
______________________________________________________________________________
_______
the translator is best described as

Application software
A system software
A hardware component
All of the above

Which of the following is the most powerful parser?

SLR
LALR
Canonical LR
Operator precedence

Which of the following are language processors?

Assembler
Compilers
interpreters
All of these

Relocating bits used by relocating loader are specified by

Relocating loader itself


Linker
Assembler
Macro processor

Synthesized attribute can be easily simulated by a


LL grammar
Ambiguous grammar
LR grammar
None of the above
A compiler that runs on one machine and produces code for a different machine is called

Cross compilation
One pass compilation
Two pass compilation
None of the above

_________or scanning is the process where the stream of characters making up the source
program is read from left to right and grouped into tokens.
Lexical analysis
Diversion
Modeling
None of the above
Input to code generator

Source code
Intermediate code
Target code
All of the above

In analysis the compilation PL/I program the description Create of more optimal matrix is
associated with

Assembly and output


code generation
Syntax analysis
machine independent optimization

A bottom up parser generates

right most derivation


right most derivation in reverse
left most derivation
left most derivation in reverse
In an absolute loading scheme which loader function is accomplished by assembler ?

re-allocation
allocation
linking
loading
41.

A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a
and b are terminals.
S→aS∣A

A→aAb∣bAa∣ϵ

1. The number of tokens in the following C statement is

printf("i = %d, &i = %x", i, &i);

a. 3

b. 26

c. 10

d. 21

2. In a compiler, keywords of a language are recognized during

a. parsing of the program

b. the code generation

c. the lexical analysis of the program

d. dataflow analysis

3. The lexical analysis for a modern computer language such as Java needs the power of which one
of the following machine models in a necessary and sufficient sense?

a. Finite state automata

b. Deterministic pushdown automata

c. Non-Deterministic pushdown automata

d. Turing Machine

4. What is the maximum number of reduce moves that can be taken by a bottom-up parser for a
grammar with no epsilon- and unit-production (i.e., of type A -> є and A -> a) to parse a string with n
tokens?

a. n/2

b. n-1

c. 2n-1

d. 2^n

5. Consider the following two sets of LR(1) items of an LR(1) grammar.

X -> c.X, c/d

X -> .cX, c/d


X -> .d, c/d

X -> c.X, $

X -> .cX, $

X -> .d, $

Which of the following statements related to merging of the two sets in the corresponding LALR parser
is/are FALSE?

1. Cannot be merged since look aheads are different.

2. Can be merged but will result in S-R conflict.

3. Can be merged but will result in R-R conflict.

4. Cannot be merged since goto on c will lead to two different sets.

a. 1 only

b. 2 only

c. 1 and 4 only

d. 1, 2, 3, and 4

6. The grammar S → aSa | bS | c is

a. LL(1) but not LR(1)

b. LR(1)but not LR(1)

c. Both LL(1)and LR(1)

d. Neither LL(1)nor LR(1)

7. Match all items in Group 1 with correct options from those given in Group 2.

Group 1 Group 2

P. Regular expression 1. Syntax analysis

Q. Pushdown automata 2. Code generation

R. Dataflow analysis 3. Lexical analysis

S. Register allocation 4. Code optimization

a. P-4. Q-1, R-2, S-3

b. P-3, Q-1, R-4, S-2

c. P-3, Q-4, R-1, S-2

d. P-2, Q-1, R-4, S-3


8. Which of the following statements are TRUE?

I. There exist parsing algorithms for some programming languages whose complexities are less than
O(n^3).

II. A programming language which allows recursion can be implemented with static storage allocation.

III. No L-attributed definition can be evaluated in The framework of bottom-up parsing.

IV. Code improving transformations can be performed at both source language and intermediate code
level.

a. I and II

b. I and IV

c. III and IV

d. I, III and IV

9. Which of the following describes a handle (as applicable to LR-parsing) appropriately?

a. It is the position in a sentential form where the next shift or reduce operation will occur

b. It is non-terminal whose production will be used for reduction in the next step

c. It is a production that may be used for reduction in a future step along with a position in the
sentential form where the next shift or reduce operation will occur

d. It is the production p that will be used for reduction in the next step along with a position in the
sentential form where the right hand side of the production may be found

10. An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if

a. the SLR(1) parser for G has S-R conflicts

b. the LR(1) parser for G has S-R conflicts

c. the LR(0) parser for G has S-R conflicts

d. the LALR(1) parser for G has reduce-reduce conflicts

11. Which one of the following is a top-down parser?

a. Recursive descent parser

b. Operator precedence parser

c. An LR(k) parser

d. An LALR(k) parser

12. Consider the grammar with non-terminals N = {S,C,S1 },terminals T={a,b,i,t,e}, with S as the start
symbol, and the following set of rules:
S --> iCtSS1|a

S1 --> eS|ϵ

C --> b

The grammar is NOT LL(1) because:

a. it is left recursive

b. it is right recursive

c. it is ambiguous

d. It is not context-free

13. Consider the following two statements:

P: Every regular grammar is LL(1)

Q: Every regular set has a LR(1) grammar

Which of the following is TRUE?

a. Both P and Q are true

b. P is true and Q is false

c. P is false and Q is true

d. Both P and Q are false

14. Consider the following grammar.

S -> S * E

S -> E

E -> F + E

E -> F

F -> id

Consider the following LR(0) items corresponding to the grammar above.

(i) S -> S * .E

(ii) E -> F. + E

(iii) E -> F + .E

Given the items above, which two of them will appear in the same set in the canonical sets-of-items for
the grammar?
a. (i) and (ii)

b. (ii) and (iii)

c. (i) and (iii)

d. None of the above

15. A canonical set of items is given below

S --> L. > R

Q --> R.

On input symbol < the set has

a. a shift-reduce conflict and a reduce-reduce conflict

b. a shift-reduce conflict but not a reduce-reduce conflict

c. a reduce-reduce conflict but not a shift-reduce conflict

d. neither a shift-reduce nor a reduce-reduce conflict

16. Consider the grammar defined by the following production rules, with two operators ∗ and +

S --> T * P

T --> U | T * U

P --> Q + P | Q

Q --> Id

U --> Id

Which one of the following is TRUE?

a. + is left associative, while ∗ is right associative

b. + is right associative, while ∗ is left associative

c. Both + and ∗ are right associative

d. Both + and ∗ are left associative

17. Consider the following grammar:

S → FR

R→S|ε

F → id

In the predictive parser table, M, of the grammar the entries M[S, id] and M[R, $] respectively

a. {S → FR} and {R → ε }
b. {S → FR} and { }

c. {S → FR} and {R → *S}

d. {F → id} and {R → ε}

18. Consider the following translation scheme. S → ER R → *E{print("*");}R | ε E → F + E


{print("+");} | F F → (S) | id {print(id.value);} Here id is a token that represents an integer and id.value
represents the corresponding integer value. For an input '2 * 3 + 4', this translation scheme prints

a. 2*3+4

b. 2 * +3 4

c. 23*4+

d. 2 3 4+*

19. The grammar A → AA | (A) | ε is not suitable for predictive-parsing because the grammar is

a. ambiguous

b. left-recursive

c. right-recursive

d. an operator-grammar

20. 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

a. n, E + n and E + n × n

b. n, E + n and E + E × n

c. n, n + n and n + n × n

d. n, E + n and E × n

21. Consider the grammar

S → (S) | a

Let the number of states in SLR(1), LR(1) and LALR(1) parsers for the grammar be n1, n2 and n3
respectively. The following relationship holds good

a. n1 < n2 < n3

b. n1 = n3 < n2

c. n1 = n2 = n3

d. n1 ≥ n3 ≥ n2
22. Consider the following expression grammar. The seman-tic rules for expression calculation are
stated next to each grammar production.

E → number E.val = number. val

| E '+' E E(1).val = E(2).val + E(3).val

| E '×' E E(1).val = E(2).val × E(3).val

The above grammar and the semantic rules are fed to a yacc tool (which is an LALR (1) parser generator)
for parsing and evaluating arithmetic expressions. Which one of the following is true about the action of
yacc for the given grammar?

a. It detects recursion and eliminates recursion

b. It detects reduce-reduce conflict, and resolves

c. It detects shift-reduce conflict, and resolves the conflict in favor of a shift over a reduce action

d. It detects shift-reduce conflict, and resolves the conflict in favor of a reduce over a shift action

23. Consider the following expression grammar. The seman-tic rules for expression calculation are
stated next to each grammar production.

E → number E.val = number. val

| E '+' E E(1).val = E(2).val + E(3).val

| E '×' E E(1).val = E(2).val × E(3).val

Assume the conflicts in Part (a) of this question are resolved and an LALR(1) parser is generated for
parsing arithmetic expressions as per the given grammar. Consider an expression 3 × 2 + 1. What
precedence and associativity properties does the generated parser realize?

a. Equal precedence and left associativity; ex-pression is evaluated to 7

b. Equal precedence and right associativity; ex-pression is evaluated to 9

c. Precedence of '×' is higher than that of '+', and both operators are left associative; expression is
evaluated to 7

d. Precedence of '+' is higher than that of '×', and both operators are left associative; expression is
evaluated to 9

24. Which of the following grammar rules violate the requirements of an operator grammar ? P, Q,
R are nonterminals, and r, s, t are terminals.

1. P → Q R

2. P → Q s R

3. P → ε
4. P → Q t R r

a. 1 only

b. 1 and 3 only

c. 2 and 3 only

d. 3 and 4 only

25. Consider the grammar with the following translation rules and E as the start symbol.

E → E1 # T { E.value = E1.value * T.value }

| T{ E.value = T.value }

T → T1 & F { T.value = T1.value + F.value }

| F{ T.value = F.value }

F → num { F.value = num.value }

Compute E.value for the root of the parse tree for the expression: 2 # 3 & 5 # 6 & 4.

a. 200

b. 180

c. 160

d. 40

26. Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

a. Removing left recursion alone

b. Factoring the grammar alone

c. Removing left recursion and factoring the grammar

d. None of these

27. 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:

a. n1 is necessarily less than n2

b. n1 is necessarily equal to n2

c. n1 is necessarily greater than n2

d. none of these

28. In a bottom-up evaluation of a syntax directed definition, inherited attributes can

a. always be evaluated
b. be evaluated only if the definition is L--attributed

c. be evaluated only if the definition has synthesized attributes

d. never be evaluated

29. Consider the grammar shown below S → i E t S S' | a S' → e S | ε E → b In the predictive parse
table. M, of this grammar, the entries M[S', e] and M[S', $] respectively are

a. {S' → e S} and {S' → e}

b. {S' → e S} and {}

c. {S' → ε} and {S' → ε}

d. {S' → e S, S'→ ε} and {S' → ε}

30. Consider the grammar shown below.

S→CC

C→cC|d

The grammar is

a. LL(1)

b. SLR(1) but not LL(1)

c. LALR(1) but not SLR(1)

d. LR(1) but not LALR(1)

31. Consider the translation scheme shown below

S→TR

R → + T {print ('+');} R | ε

T → num {print (num.val);}

Here num is a token that represents an integer and num.val represents the corresponding integer value.
For an input string '9 + 5 + 2', this translation scheme will print

a. 9+5+2

b. 95+2+

c. 952++

d. ++952

32. Consider the syntax directed definition shown below.

S → id : = E {gen (id.place = E.place;);}


E → E1 + E2 {t = newtemp ( ); gen (t = El.place + E2.place;); E.place = t}

E → id {E.place = id.place;}

Here, gen is a function that generates the output code, and newtemp is a function that returns the
name of a new temporary variable on every call. Assume that ti's are the temporary variable names
generated by newtemp. For the statement 'X: = Y + Z', the 3-address code sequence generated by this
definition is

a. X=Y+Z

b. t1 = Y + Z; X = t1

c. t1 =Y; t2 = t1 + Z; X = t2

d. t1 = Y; t2 = Z; t3 = t1 + t2; X = t3

33. Which of the following statements is false?

a. An unambiguous grammar has same leftmost and rightmost derivation

b. An LL(1) parser is a top-down parser

c. LALR is more powerful than SLR

d. An ambiguous grammar can never be LR(k) for any k

34. Which of the following derivations does a top-down parser use while parsing an input string?
The input is assumed to be scanned in left to right order.

a. Leftmost derivation

b. Leftmost derivation traced out in reverse

c. Rightmost derivation

d. Rightmost derivation traced out in reverse

35. Given the following expression grammar:

E -> E * F | F + E | F

F -> F - F | id

which of the following is true?

a. * has higher precedence than +

b. – has higher precedence than *

c. + and — have same precedence

d. + has higher precedence than *


36. Which one of the following is True at any valid state in shift-reduce parsing?

a. Viable prefixes appear only at the bottom of the stack and not inside

b. Viable prefixes appear only at the top of the stack and not inside

c. The stack contains only a set of viable prefixes

d. The stack never contains viable prefixes

37. In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the
following is True?

a. In both AST and CFG, let node N2 be the successor of node N1. In the input program, the code
corresponding to N2 is present after the code corresponding to N1

b. For any input program, neither AST nor CFG will contain a cycle

c. The maximum number of successors of a node in an AST and a CFG depends on the input
program

d. Each node in AST and CFG corresponds to at most one statement in the input program

38. Match the following:

List-I List-II

A. Lexical analysis 1. Graph coloring

B. Parsing 2. DFA minimization

C. Register allocation 3. Post-order traversal

D. Expression evaluation 4. Production tree

Codes:

ABCD

(a) 2 3 1 4

(b) 2 1 4 3

(c) 2 4 1 3

(d) 2 3 4 1

39. 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?

a. SLR, LALR

b. Canonical LR, LALR


c. SLR, canonical LR

d. LALR, canonical LR

40. Consider the following grammar G.

S→F⎪H

F→p⎪c

H→d⎪c

Where S, F and H are non-terminal symbols, p, d and c are terminal symbols. Which of the following
statement(s) is/are correct?

S1: LL(1) can parse all strings that are generated using grammar G.

S2: LR(1) can parse all strings that are generated using grammar G.

a. Only S1

b. Only S2

c. Both S1 and S2

d. Neither S1 and S2

41.For the correct answer in Q75, how many steps are required to derive the string and how many parse
trees are there?

a. 6 and 1

b. 6 and 2

c. 7 and 2

d. 4 and 2

42. Some code optimizations are carried out on the intermediate code because

a. they enhance the portability of the compiler to other target processors

b. program analysis is more accurate on intermediate code than on machine code

c. the information from dataflow analysis cannot otherwise be used for optimization

d. the information from the front end cannot otherwise be used for optimization

43. Which one of the following is FALSE?

a. A basic block is a sequence of instructions where control enters the sequence at the beginning
and exits at the end

b. Available expression analysis can be used for common subexpression elimination

c. Live variable analysis can be used for dead code elimination


d. x = 4 ∗ 5 => x = 20 is an example of common subexpression elimination

44. One of the purposes of using intermediate code in compilers is to

a. make parsing and semantic analysis simpler

b. improve error recovery and error reporting

c. increase the chances of reusing the machine-independent code optimizer in other compilers

d. improve the register allocation

45. Consider the grammar rule E → E1 - E2 for arithmetic expressions. The code generated is
targeted to a CPU having a single user register. The subtraction operation requires the first operand to
be in the register. If E1 and E2 do not have any common sub expression, in order to get the shortest
possible code

a. E1 should be evaluated first

b. E2 should be evaluated first

c. Evaluation of E1 and E2 should necessarily be interleaved

d. Order of evaluation of E1 and E2 is of no consequence

46. Consider the intermediate code given below:

1. i = 1

2. j = 1

3. t1 = 5 * i

4. t2 = t1 + j

5. t3 = 4 * t2

6. t4 = t3

7. a[t4] = –1

8. j = j + 1

9. if j <= 5 goto(3)

10. i = i + 1

11. if i < 5 goto(2)

The number of nodes and edges in the control-flow-graph constructed for the above code, respectively,
are

a. 5 and 7

b. 6 and 7
c. 5 and 5

d. 7 and 8

47. Consider the following code segment.

x = u - t;

y = x * v;

x = y + w;

y = t - z;

y = x * y;

The minimum number of total variables required to convert the above code segment to static single
assignment form is

a. 6

b. 8

c. 9

d. 10

48. Which of the following derivations does a top-down parser use while parsing an input string?

The input is assumed to be scanned in left to right order.

a. Leftmost derivation

b. Leftmost derivation traced out in reverse

c. Rightmost derivation

d. Rightmost derivation traced out in reverse

49. Which of the following statements is false ?

a. An unambiguous grammar has same leftmost and rightmost derivation

b. An LL(1) parser is a top-down parser

c. LALR is more powerful than SLR

d. An ambiguous grammar can never be LR(k) for any k

50. Consider a program P that consists of two source modules M1 and M2 contained in two different
files. If M1 contains a reference to a function defined in M2, the reference will be resolved at

a.Edit-time
b.Compile-time

c.Link-time

d.Load-time

51. Consider the following statements:

(I) The output of a lexical analyzer is groups of characters.


(II) Total number of tokens in printf("i=%d, &i=%x", i, &i); are 11.
(III) Symbol table can be implementation by using array and hash table but not tree.

Which of the following statement(s) is/are correct?

a. Only (I)

b. Only (II) and (III)

c. All (I), (II), and (III)

d. None of these

52. Which one of the following statements is FALSE ?

a. Context-free grammar can be used to specify both lexical and syntax rules.

b. Type checking is done before parsing.

c. High-level language programs can be translated to different Intermediate Representations.

d. Arguments to a function can be passed using the program stack.

53. A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b

T1: a?(b∣c)*a
T2: b?(a∣c)*b
T3: c?(b∣a)*c

Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that mat
bbaacabc is processes by the analyzer, which one of the following is the sequence of tokens it outputs?

a. T1T2T3

b. T1T1T3
c. T2T1T3

d. T3T3

54. Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts

a. (1)

b. (2)

c. (3)

d. (4)

55. The output of a lexical analyzer is

a. A parse tree
b. Intermediate code

c. Machine code

d. A stream of tokens

56. The number of tokens in the following C statement is printf("i=%d, &i=%x", i&i);

a. 13

b. 6

c. 10

d. 9

57. A particular BNF definition for a "word" is given by the following rules. Which of the following lexical entries ca
I. pick
II. picks
III. c44

a. I, II and III

b. I and II only

c. l and III only

d. lI and III only

58. For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that ne
ε is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.
a. A

b. B

c. C
1. compiler work, source code into____?.

A. Machine code

B. Executable code

C. Binary code

D. Both B and C

E. Both A and C

2. How many numbers of tokens in this statement__.

printf(“k= %d, &k = %x”, k, &k);

A. 11

B. 31
C. 4

D. 10

E. none of these

3. one or more parse tree for some sentence, that is ____grammer.

a) Unambiguous

b) Ambiguous

c) Both A and B

d) None of these

4. A lexical analyzer produce____?

A. Machine code

B. Binary code

C. tokens

D. Both A and B

E. None of these

5. The parts of the compiler are __.

A. 6

B. 8

C. 2

D. 3

E. None of these

6. One of the fastest logic is __?.

A. ECL

B. TTL

C. Both A and B

D. None of these

7. compiler indicate the ____error.

A. Syntax error

B. Logical error

C. Run time error


D. All of these

8.___ is not a phase of compiler.

A. syntax

B. testing

C. lexiacal

D. Both A and C

E. None of these

9. Parsing is also called____ analysis?

A. semantic

B. lexical

C. syntax

D. Both A and B

10. A process, a string of tokens can be generated by___.

A. Parsing

B. Analysing

C. Translating

D. All of these

You might also like