0% found this document useful (0 votes)
245 views63 pages

CD MCQ

This document contains 30 multiple choice questions about compiler design topics such as optimization techniques, symbol tables, parsing, code generation, and more. The questions test understanding of concepts like constant folding, flow graphs, storage allocation, relocatable vs non-relocatable programs, scoping rules, macro processing, error recovery, and register allocation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
245 views63 pages

CD MCQ

This document contains 30 multiple choice questions about compiler design topics such as optimization techniques, symbol tables, parsing, code generation, and more. The questions test understanding of concepts like constant folding, flow graphs, storage allocation, relocatable vs non-relocatable programs, scoping rules, macro processing, error recovery, and register allocation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 63

Compiler design

vIn which of the following no information hiding is done ?

A.compile prog 1, prog 2

B. run test, prog

C.load R , A
1

D.001001000010101
Answer Report Discuss
Option: D

Explanation :

2:
The identification of common sub-expression and replacement of run-time computations by compile-
time computations is

A.local optimization

B. loop optimization

C.constant folding

D.data flow analysis


Answer Report Discuss
Option: C

Explanation :

3:
The graph that shows basic blocks and their successor relationship is called

A.DAG

B. Flow graph

C.control graph

D.Hamiltonion graph
Answer Report Discuss
Option: B

Explanation :
4:
The specific task storage manager performs

A.allocation/ deallocation of storage to programs

B. protection of storage area allocated to a program from illegal access by othere


programs in the system

C.the status of each program

D.both ( a ) and ( b )
Answer Report Discuss
Option: D

Explanation :

5:
When a computer is first turned on or resrarted, a special type of absolute loader is executed called

A." Compile and GO " loader

B. Boot loader

C.Boot strap loader

D.Relating loader
Answer Report Discuss
Option: C

Explanation :

6:
Disadvantage of " Compile and GO " loading scheme is that

A.a portion of memory is wasted because the case occupied by the assembler is
unavailable to the object program

B. it is necessary to retranslate the users program and check everytime it is run

C.it is very difficult to handle multiple segments, especially if the source programs
are in different languages and to produce orderly modular programs

D.all of these
Answer Report Discuss
Option: D

Explanation :

7:
Function of the storage assignment is
A.assign storage to all variables referenced in the source program

B. assign storage to all temporary locations that are necessary for intermediate
results

C.assign storage to literals, and to ensure that the storage is allocated and
appropriate locations are initialized

D.all of these
Answer Report Discuss
Option: D

Explanation :

8:
A non relocatable program is the one which

A.cannot be made to execute in any area of storage other than the one designated
for it at the time of its coding or translation

B. consists of a program and relevant information for its relocation

C.can itself perform the relocation of its address sensitive portions

D.all of these
Answer Report Discuss
Option: A

Explanation :

9:
A relocatable program form is one which

A.cannot be made to execute in any area of storage other than the one designated
for it at the time of its coding or translation

B. consists of a program and relevant information for its relocation

C. can be processed to relocate it to a desired area of memory

D.all of these
Answer Report Discuss
Option: C

Explanation :

eg object module

10:
A self-relocating program is one which
A.cannot be made to execute in any area of storage other than the one designated
for it at the time of its coding or translation

B. consists of a program and relevant information for its relocation

C.can itself perform the relocation of its address sensitive portions

D.all of these
Answer Report Discuss
Option: C

11:
Scissoring enables

A.a part of data to be displayed

B. entire data to be displayed

C.full data display on full area of screen

D.no data to be displayed


Answer Report Discuss
Option: A

Explanation :

12:
Which of the following can be accessed by transfer vector approach of linking ?

A.external data segments

B. external sub-routines

C.data located in other procedure


D.all of these
Answer Report Discuss
Option: B

Explanation :

13:
Relocation bits used by relocating loader are specified by

A.relocating loader itself

B. linker
C.assembler

D.macro processor
Answer Report Discuss
Option: B

Explanation :

14:
Generation of intermediate code based on a abstract machine model is useful in compilers because

A.it makes implementation of lexical analysis and syntax analysis easier

B. syntax directed translations can be written for intermediate code generation

C.it enhances the portability of the front end of the compiler

D.it is not possible to generate code for real machines directly from high level
language programs
Answer Report Discuss
Option: A

Explanation :

15:
Which of the following module does not incorporate initialization of values changed by the module ?

A.non reusable module

B. serially reusable module

C.re-enterable module

D.all of these
Answer Report Discuss
Option: A

Explan

16:
In some programming languages, an identifier is permitted to be a letter followed by any number of
letters or digits. If L and D denotes the sets of letters and digits respectively, which of the following
expressions define an identifier ?

A.( L∪ D ) *

B. L ( L ∪ D)*

C.( L . D )*
D.L . ( L . D )*
Answer Report Discuss
Option: B

Explanation :

17:
A language L allows declaration of arrays whose sizes are not known during compilation. It is required
to make efficient use of memory. Which one of the following is true ?

A.a compiler using static memory allocation can be written for L

B. a compiler cannot be written for L ; an interpreter must be used

C.a compiler using dynamic memory allocation can be written for L

D.none of these
Answer Report Discuss
Option: C

Explanation :

18:
What are x and y in the following macro definition?
macro
Add x, y
Load y
Mul x
Store y
end macro

A.variables

B. identifiers

C.actual parameters

D.formal parameters
Answer Report Discuss
Option: D

Explanation :

19:
What is the value of X printed by the following program ?

program COMPUTE ( input, output );

var X : integer ;
procedure FIND ( X: real ) ;
begin
X : = sqrt ( X ) ;
end ;
begin
X:=2
FIND ( X )
writeln ( X )
end

A.2

B. √2

C.Run-time error

D.none of these
Answer Report Discuss
Option: A

Explanation :

20:
Which of the following macros can put a macro assembler into an infinite loop ?

A.MACRO M1, X
IF EQ, X if X = 0 then....
M1 X + 1
ENDC
IF NE, X : IF X ≠ 0 then......
WORD X : address (X) is stored here
ENDC
ENDM

B. MACRO M2, X
IF EQ, X
M2 X
ENDC
IF NE, X
WORD X + 1
ENDC
ENDM

C.both (a) and (b)

D.none of these
Answer Report Discuss
Option: B

Explanation :

21:
Given the following Pascal-like program segment
Procedure A,
x, y : integer ;
Procedure B;
x, z : real ;
S1
end B;
Procedure C;
i : integer ;
S2
end C
end A;
The variables accessible in S1 and S2 are

A.x of A, y, x of B and z in S1 and x of B, y and i in S2

B. x of B, y and z in S1 and x of B, i and z in S2

C.x of B, z and y in S1 and x of A, i and y in S2

D.none of these
Answer Report Discuss
Option: C

Explanation :

22:
An intermediate code form is

A.postfix notation

B. syntax trees

C.three address codes

D.all of these
Answer Report Discuss
Option: D

Explanation :

23:
Three address code invloves
A.exactly 3 address

B. at the most 3 address

C.no unary operators

D.none of these
Answer Report Discuss
Option: B

Explanation :

24:
The best way to compare the different implementations of symbol table is to compare the time required
to

A.add a new name

B. make an inquiry

C.add a new name and make an inquiry

D.all of these
Answer Report Discuss
Option: D

Explanation :

25:
Advantage of panic mode of error recovery is that

A.it is simple to implement

B. it never gets into an infinite loop

C.both (a) and (b)

D.none of these
Answer Report Discuss
Option: C

Explanation :

26:
To recover from an error, the operator precedence parser may

A.insert symbols onto the stack and onto the input


B. delete symbols from the stack
C.delete symbols from the input

D.all of these
Answer Report Discuss
Option: D

Explanation :

27:
Reduction in strength means

A.replacing run-time computation by compile time computation

B. replacing a costly operation by a relatively cheaper one

C.Both (a) & (b)

D.removing loop invariant computation


Answer Report Discuss
Option: C

Explanation :

28:
Running time of a program depends on

A.the way the registers and addressing modes are used

B. the order in which computations are performed

C.the usage of machine idioms

D.all of these
Answer Report Discuss
Option: D

Explanation :

29:
If control signals {a,b,c,d,e,f,g} for some micro instructions and their corresponding MCCS (Maximum
Compatibility Classes) are
[ad f* g, abd, beg, b deg}
then to determine minimal MCC cover, we need to remove

A.adfg

B. afd
C.bcg
D.bdeg
Answer Report Discuss
Option: B

Explanation :

30:
Assume that X and Y are non zero positive integers. What does the following Pascal program segment
do?

while X < > Y do


if X > Y then
X: = X-Y
else
Y:=Y-X;
write (X);

A.Computes LCM of two numbers

B. Divides larger number by the smaller number

C.Computes GCD of two numbers

D.None of these
Answer Report Discuss
Option: C

Explanation :

31.

V A variant record in Pascal is defined by

type varirec = record


number : integer
case(varl, var2)of
var 1 : (x, y : integer);
var2 : (p.q. : real);
end;
end ;

Let an array of 100 records was declared on a machine which uses 4 bytes for an integer and 8 bytes
for a real. How much space would the compiler have to reserve for the array ?

A.2800

B.2400

C.2000
D.1200

Answer Report Discuss


Option: C

1:
In analyzing the compilation of PL/I program, the term "Machine independent optimization" is
assosiated with

A.recognization of basic syntactic construction through reductions

B. recognition of basic elements and creation of uniform symbols

C.creation of more optical matrix

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


Answer Report Discuss
Option: C

Explanation :

2:
In analyzing the compilation of PL/I program the description " resolving symbolic address ( lables )
and generating machine language " is associated with

A.assembly and output

B. code generation

C.storage assignment

D.syntax analysis
Answer Report Discuss
Option: A

Explanation :

3:
In analyzing the compilation of PL/I program the description " creation of more optimal matrix " is
assosiated with

A.assembly and output

B. code generation

C.syntax analysis

D.machine independent optimization


Answer Report Discuss
Option: D

Explanation :

4:
Peep-hole optimization is a form of

A.loop optimization

B. local optimization

C.constant folding

D.data flow analysis


Answer Report Discuss
Option: C

Explanation :

Redundant instructions may be discarded during the final stage of compilation by using a simple optimizing
technique called peephole optimization.It is a kind of optimization performed over a very small set of
instructions in a segment of generated code. The set is called a "peephole" or a "window". It works by
recognising sets of instructions that can be replaced by shorter or faster sets of instructions and it uses some
common techniques : Constant folding. So option (C) is correct

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 these
Answer Report Discuss
Option: C

Explanation :

6:
Local and loop optimization in turn provide motivation for

A.data flow analysis

B. constant folding

C.peep hole optimization

D.DFA and constant folding


Answer Report Discuss
Option: A

Explanation :

7:
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
Answer Report Discuss
Option: C

Explanation :

8:
A linker reads four modules whose lengths are 200, 800, 600 and 500 words, respectively. If they are
loaded in that order, what are the relocation constants ?

A.0, 200, 500, 600

B. 0, 200, 1000, 1600

C.200, 500, 600, 800

D.200, 700, 1300, 2100


Answer Report Discuss
Option: C

Explanation :

9:
An optimizing compiler

A.is optimized to occupy less space

B. is optimized to take less time for execution

C.optimizes the code

D.All of the above


Answer Report Discuss
Option: D

Explanati
1:
In an aboslute loading scheme, which loader function is accomplished by programmer?

A.Allocation
B. LInking
C.Reallocation
D.both (A) and (B)
Answer Report Discuss
Option: D

Explanation :

2:
A compiler program written in a high level language is called

A.source program
B. object program
C.machine language program
D.none of these
Answer Report Discuss
Option: A

Explanation :

3:
Advantage of using assembly language rather than machine language is that

A.it is mneomonic and easy to read


B. addresses any symbolic not absolute
C.introduction of data to program is easier
D.All of these
Answer Report Discuss
Option: D

Explanation :

4:
An interpreter is a program that

A.places programs into memory and prepares them for execution


B. automates the translation of assembly language into machine language.
C.accesses a program written in a high level language and produces an object program.
D.appears to execute a source program as if it were machine language.
Answer Report Discuss
Option: D

Explanation :

5:
Language which have many types, but the type of every name and expression must be calculated at
compile time are
A.strongly-type languages
B. weakly typed languages
C.loosely typed languages
D.none of these
Answer Report Discuss
Option: A

Explanation :

6:
Terminal table

A.contains all constants in the program.


B. is a permanent table of decision rules in the form of patterns for matching with the uniform
symbol table to discover syntactic structure.
C.consist of a full or partial list of the token is as they appear in the program created by
lexical analysis and used for syntax analysis and interpretation.
D.is a permanent table which lists all keywords and special symbols of the language in
symbolic form
Answer Report Discuss
Option: D

Explanation :

7:
Advantage of incorporating the macro-processor into pass 1 is that

A.many functions have to be implemented twice


B. functions are combined and it is not necessary to create intermediate files as output from
the macro-processor and input to the assembler.
C.more flexibility is available to the programmer in that he may use all the features of the
assembler in conjunction with macros.
D.all of these
Answer Report Discuss
Option: D

Explanation :

8:
Which of the following is a phase of a compilation process ?

A.Lexical analysis
B. Code generation
C.Both (a) and (b)
D.None of these
Answer Report Discuss
Option: C

Explanation :

9:
System program such a s compiler are designed so that they are

A.re-enterable
B. non-reusable
C.serially usable
D.None of these
Answer Report Discuss
Option: A

Explanation :

10:
A series of statements explaining how the data is to be processed is called

A.assembly
B. machine
C.COBOL
D.program
Answer Report Discuss
Option: D

Explanatio

11:
A loader is a program that

A.program that places programs into memory and prepares them for execution.
B. program that automates the translation of assembly language into machine language.
C.program that accepts a program written in a high level language and produces as object
program
D.None of these
Answer Report Discuss
Option: A

Explanation :

12:
A system program that setup an executable program in main memory ready for execution is

A.assembler
B. linker
C.loader
D.load and go
Answer Report Discuss
Option: C

Explanation :

13:
Which of the following system program forgoes the production of object code to generate absolute
machine code and load it into the physical main storage location from which it will be executed
immediately upon completion of the assembly ?

A.Two pass assembler

B. Load-and-go-assembler

C.Macroprocessor

D.Linker
Answer Report Discuss
Option: B

Explanation :

14:
Uniform symbol table

A.contains all constants in the program


B. is a permanent table of decision rules in the form of patterns for matching with the uniform
symbol table to discover syntactic structure.
C.consists of full or partial list of the token's as they appear in the program created by Lexical
analysis and used for syntax analysis and interpretation.
D.a permanent table which lists all key words and special symbols of the language in
symbolic form.
Answer Report Discuss
Option: C

Explanation :

15:
Assembler is a program that

A.places programs into memory and prepares them for execution


B. automates the translation of assembly language into machine language
C.accepts a program written in a high level language and produces an object program.
D.None of these
Answer Report Discuss
Option: B

Explan

16:
Compiler can diagnose

A.grammatical errors only


B. logical errors only
C.grammatical as well as logical errors
D.None of these
Answer Report Discuss
Option: A

Explanation :

17:
A simple two-pass assembler does which of the following in the first pass ?

A.It allocates space for the literals


B. It computes the total length of the program
C.It builds the symbol table for the symbols and their values.
D.All of these
Answer Report Discuss
Option: D

Explanation :

18:
A system program that set-up an executable program in main memory ready for execution is

A.assembler
B. linker
C.loader
D.text editor
Answer Report Discuss
Option: C

Explanation :

19:
A compiler is a program that

A.places programs into memory and prepares them for execution.


B. automates the translation of assembly language into machine language.
C.accepts a program written in a high level language and produces an object program.
D.None of these
Answer Report Discuss
Option: C

Explanation :

20:
A programmer, by mistake, writes an instruction to divide, instead of a multiply, such error can be
detected by a/an

A.compiler

B. interpreter

C.compiler or interpreter test


D.None of these
Answer Report Discuss
Option: D

Explanati

21:
The computer language generally translated to pseudocode is

A.assembly
B. machine
C.pascal
D.FORTRAN
Answer Report Discuss
Option: A

Explanation :

22:
A system program that combines separately compiled modules of a program into a form suitable for
execution is

A.assembler
B. linking loader
C.cross compiler
D.None of these
Answer Report Discuss
Option: B

Explanation :

23:
In which way a macro processor for assembly language can be implemented?

A.Independent two-pass processor


B. Independent one-pass processor
C.Processor incorporated into pass 1 of a standard two pass assembler
D.All of these
Answer Report Discuss
Option: D

Explanation :

24:
Resolution of externally defined symbols is performed by

A.Linker
B. Loader
C.Compiler
D.Interpreter
Answer Report Discuss
Option: A

Explanation :

25:
A shift reduce parser carries out the actions specified within braces immediately after reducing with
the corresponding rule of grammer

S----> xxW ( PRINT "1")

S----> y { print " 2 " }

S----> Sz { print " 3 " )

What is the translation of xxxxyzz using the syntax directed translation scheme described by the above
rules ?

A.23131

B. 11233

C.11231

D.33211
Answer Report Discuss
Option: A

Explanation :

26:
The symbol table implementation is based on the property of locality of reference is

A.linear list

B. search tree

C.hash table

D.self-organization list
Answer Report Discuss
Option: C

Explanation :

27:
In operator precedence parsing, precedence relations are defined

A.for all pair of non-terminals


B. for all pair of terminals
C.to delimit the handle

D.none of these
Answer Report Discuss
Option: A

Explanation :

There are two important properties for these operator precedence parsers is that it does not appear on the
right side of any production and no production has two adjacent nonterminals. Means no production right side
is empty or has two adjacent nonterminals. So accordig to property option (A) is correct.

28:
LR parsers are attractive because

A.it can be constructed to recognize CFG corresponding to almost all programming


constructs

B. it doesnot backtrack

C.both (a) and (b)

D.none of these
Answer Report Discuss
Option: C

Explanation :

29:
The most powerful parser is

A.SLR

B. LALR

C.Canonical LR

D.Operator-precedence
Answer Report Discuss
Option: C

Explanation :

30:
YACC builds up

A.SLR parsing table

B. canonical LR parsing table


C.LALR parsing table

D.none of these
Answer Report Discuss
Option: C

Explanati

31:
Object program is a

A.program written in machine language

B. program to be translated into machine language

C.translation of high-level language into machine language

D.none of these
Answer Report Discuss
Option: C

Explanation :

32:
Let ( Z,* ) be an algebraic structure, where Z is set of integers and the operation *
is defined by n * m =maximum ( n , m )

Which of the following statements is true for ( Z, * ) ?

A.( Z,* ) is a monoid

B. ( Z,* ) is an algebraic group

C.( Z,* ) is a group

D.none of these
Answer Report Discuss
Option: D

1:
In a single pass assembler, most of the forward references can be avoided by putting the restriction

A.on the number of strings/lifereacts


B. that the data segment must be defined after the code segment.
C.on unconditional rump.
D.None of these
Answer Report Discuss
Option: B

Explanation :

2:
The method which merges the bodies of two loops is

A.loop rolling

B. loop Jamming

C.constant folding

D.none of these
Answer Report Discuss
Option: B

Explanation :

3:
Assembly code data base is associated with

A.assembly language version of the program which is created by the code.


B. a permanent table of decision rules in the form of patterns for matching with the uniform
symbol table to discover syntactic structure.
C.Both (a) and (b)
D.a permanent table which lists all key words and special symbols of the language in
symbolic form.
Answer Report Discuss
Option: A

Explanation :

4:
The process manager has to keep track of

A.status of each program


B. priority of each program
C.information management support to a programmer using the system.
D.Both (A) and (C)
Answer Report Discuss
Option: D

Explanation :

5:
Function of the syntax phase is to

A.recognize the major constructs of the language and to cal the appropriate action routines
that wil generate the intermediate form or matrix for these constructs
B. build a literal table and an identifier table.
C.build a uniform symbol table.
D.parse the source program into the basic elements or tokens of the language.
Answer Report Discuss
Option: A

Explana

:
In an absolute loading scheme, which loader function is accomplished by assembler ?

A.Reallocation
B. Allocation
C.Linking
D.Loading
Answer Report Discuss
Option: A

Explanation :

7:
Which of the following translation program converts assembly language programs to object program

A.assembler
B. Compiler
C.Macroprocessor
D.Loader
Answer Report Discuss
Option: A

Explanation :

8:
Loop is a collection of nodes that is

A.strongly connected
B. loosely connected and has a unique entry
C.strongly connected and has a unique entry
D.none of these
Answer Report Discuss
Option: C

Explanation :

9:
The conditional expansion facility of macro procesors is provided to

A.test a condition during the execution of the expanded program


B. to expand certain model statements depending upon the value of a condition during the
execution of the expanded program
C.Both (a) and (b)
D.to expand certain model statements depending upon the value of a condition during the
process of macro expansion.
Answer Report Discuss
Option: D

Explanation :

10:
The part of the machine level instruction, which tells the central processor what has to be done is

A.Operation code
B. Address
C.Locator
D.Flip Flop
Answer Report Discuss
Option: A

Ex

11:
If E be a shifting operation applied to a function f, such that E(f) = f (x +β ), then

A.E (αf+β g) =α E(f) +β E (g)

B. E (αf +β g )=. ( α+ β )+ E (f + g)

C.E (αf +β g )=α E (f+gβ)

D.E (αf +β g )=αβ E (f + g)


Answer Report Discuss
Option: A

Explanation :

12:
Pass I

A.assign address to all statements in the program


B. save the values assigned to all labels for use in pass 2
C.perform some processing of assembler directives
D.all of these
Answer Report Discuss
Option: D

Explanation :

13:
Which table is permanent databases that has an entry for each terminal symbol ?

A.Terminal table
B. Literal table
C.Identiier table
D.None of these
Answer Report Discuss
Option: A

Explanation :

14:
Which of the following functions is performed by loader ?

A.Allocate space in memory for the programs and resolve symbolic references between
objects decks
B. Adjust all address dependent locations, such as address constants, to correspond to the
allocated space.
C.Physicaly place the machine instructions and data into memory
D.All of these.
Answer Report Discuss
Option: D

Explanation :

15:
The root directory of a disk should be placed

A.at a fixed address in main memory


B. at a fixed location on the disk
C.anywhere on the disk
D.None of these
Answer Report Discuss
Option: B

Explanati

16:
The segment base is specified using the register named is

A.ORG instructions
B. TITLE instruction
C.ASSUME instruction
D.SEGMENT instruction
Answer Report Discuss
Option: A

Explanation :

17:
In what module multiple instances of execution will yield the same result even if
one instance has not terminated before the next one has begun ?

A.Non reusable module


B. Serially usable
C.Re-entrable module
D.None of these
Answer Report Discuss
Option: C

Explanation :

18:
Dividing a project into segments and smaller units in order to simplify analysis,
design and programming efforts is called

A.Modular approach
B. Top down approach
C.Bottom up approach
D.Left right approach
Answer Report Discuss
Option: A

Explanation :

19:
Which one of the following is the tightest upper bound that represents the time
complexity of inserting an object into a binary search tree of n nodes? (GATE-
2013)

A.O(1)

B. O(log n)

C.O(n)

D.O(n log n)
Answer Report Discuss
Option: C

Explanation :

For skewed binary search tree on n nodes, the tightest upper bound to insert a node is O(n)

20:
Which ofthe folowing is true for machine language?

A.Repeated execution of program segments


B. Depicting flow of data in a system
C.A sequence of instructions which, when followed properly, solves a problem
D.The language which communicates with the computer using only the binary digits 1 and 0.
Answer Report Discuss
Option: D

21:
Sotware that measures, monitors, analyzes and controls real world events is called

A.System software
B. Real time software
C.Scientific software
D.Business software
Answer Report Discuss
Option: B

Explanation :

22:
A linker is given object module for a set ofprograms that were compiled separately. What information
need not be included in an object module

A.Object code
B. Relocation bits
C.Names and locations of all external symbols deined in the object module ?
D.Absolute addresses of internal symbols.
Answer Report Discuss
Option: D

Explanation :

23:
The table created by lexical analysis to describe all literals used in the source program is

A.Terminal table
B. Literal table
C.Identiier table
D.Reductions
Answer Report Discuss
Option: B

Explanation :

24:
In an absolute loading scheme, which loader function is accomplished by loader ?

A.Reallocation
B. Allocation
C.Linking
D.Loading
Answer Report Discuss
Option: D

Explanation :

25:
Pass 2
A.assemble instruction and generate data
B. perform processing of assembler directives not done during pass 1
C.write the object program and assembly listing
D.all of these
Answer Report Discuss
Option: D

Explan

Which is not true about syntax and semantic parts of a computer language?

A.Syntax is generally checked by the programmer.


B. Semantics is the responsibility of the programmer
C.Semantics is checked mechanically by a computer.
D.Both (b) and (c)
Answer Report Discuss
Option: D

Explanation :

27:
Which of the following statement is true ?

A.SLR parser is more powerful than LALR

B. LALR parser is more powerful than Canonical LR parser

C.Canonical LR parser is nore powerful than LALR parser

D.the parsers SLR, Canonical LR, and LALR have the same power
Answer Report Discuss
Option: C

Explanation :

LR is powerful than LALR parsers and LALR are powerful than SLR parsers

28:
Which of the following features cannot be captured by CFG ?

A. syntax of if-then-else statements

B. syntax of recursive procedures

C. whether a variable is declared before its use

D. matching nested paranthesis


Answer Report Discuss
Option: D
Explanation :

it is because, it is equivalent to recognizing wew, where the first w is the decleration and the second is its use, wew is not
a CFG.

Three address code involves

Exactly 3 address
At most most 3 address
No unary operators
None of these
_____________________________________________________________________________________
An intermediate code form is

Postfix notation
Syntax trees
Three address code
All 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
_____________________________________________________________________________________
Relocating bits used by relocating loader are specified by

Relocating loader itself


Linker
Assembler
Macro processor
_____________________________________________________________________________________
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
_____________________________________________________________________________________
Synthesized attribute can be easily simulated by a

LL grammar
Ambiguous grammar
LR grammar
None of the above
_____________________________________________________________________________________
The output of a lexical analyzer is

Machine code
Intermediate code
A stream of tokens
A parse tree
_____________________________________________________________________________________
Running time of a program depends on

The way the registers and addressing modes are used


The order in which computations are performed
The usage of machine idioms
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
_____________________________________________________________________________________
_________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
_____________________________________________________________________________________
Task of the lexical analysis

To parse the source program into the basic elements or tokens of the language
To build a literal table and an identifier table
To build a uniform symbol table
All of these
_____________________________________________________________________________________
Shift reduce parsers are

Top down parser


Bottom up parser
May be top down or bottom up parser
None of the above
_____________________________________________________________________________________
Any description error can be repaired by

Insertion alone
Deletion alone
Insertion and deletion alone
Replacement alone
_____________________________________________________________________________________
The linker

is similar to interpreter
uses source code as its input
is required to create a load module
none of the above
_____________________________________________________________________________________
A grammar that produces more than one parse tree for some sentence is called

Ambiguous
Unambiguous
Regular
None of these
_____________________________________________________________________________________
In an absolute loading scheme which loader function is accomplished by assembler ?

re-allocation
allocation
linking
loading
_____________________________________________________________________________________
Intermediate code generation phase gets input from

Lexical analyzer
Syntax analyzer
Semantic analyzer
Error handling
_____________________________________________________________________________________
We can optimize code by

Dead code elimination


Common subprograms
Copy intermediate loop
Loop declaration
_____________________________________________________________________________________
Code can be optimized at

Source from user


Target code
Intermediate code
All of the above
_____________________________________________________________________________________
Whether a given pattern constitutes a token or not depends on the

Source language
Target language
Compiler
All of these
_____________________________________________________________________________________
YACC builds up

SLR parsing table


Canonical LR parsing table
LALR parsing table
None of the above
_____________________________________________________________________________________
Type checking is normally done during

Lexical analysis
Syntax analysis
Syntax directed translation
Code optimization
_____________________________________________________________________________________
A top down parser generates

Right most derivation


Right most derivation in reverse
Left most derivation
Left most derivation in reverse
_____________________________________________________________________________________
Which of the following does not interrupt a running process?

A device
Timer
Scheduler
Power failure
_____________________________________________________________________________________
In an absolute loading scheme, which loader function is accomplished by a loader ?

Re-allocation
Allocation
Linking
Loading
_____________________________________________________________________________________
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
_____________________________________________________________________________________
Which of the following can be accessed by transfer vector approach of linking?

External data segments


External subroutines
Data located in other procedure
All of these
_____________________________________________________________________________________
___________is a graph representation of a derivation.

The parse tree


The oct tree
The binary tree
None of the above
_____________________________________________________________________________________
The optimization which avoids test at every iteration is

Loop unrolling
Loop jamming
Constant folding
None of these
_____________________________________________________________________________________
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 parser with the valid prefix property is advantageous because it

Detects error as soon as possible


Detects errors as and when they occur
Limits the amount of erroneous output passed to the text phase
All of these
_____________________________________________________________________________________
Which of the following parser is most powerful?

Operator precedence
Canonical LR
LALR
SLR
_____________________________________________________________________________________
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
_____________________________________________________________________________________
Macro-processors are ______

Hardware
Compiler
Registers
None of the above
_____________________________________________________________________________________
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
_____________________________________________________________________________________
‘Macro’ in an assembly level program is _______.

sub program
a complete program
a hardware portion
relative coding
_____________________________________________________________________________________
The optimization technique which is typically applied on loops is

Removal of invariant computation


Peephole optimization
Constant folding
All of these
_____________________________________________________________________________________
Concept which can be used to identify loops is

Dominators
Reducible graphs
Depth first ordering
All of these
_____________________________________________________________________________________
Local and loop optimization in turn provide motivation for

Data flow analysis


Constant folding
Pee hole optimization
DFA and constant folding
_____________________________________________________________________________________
LR stands for

Left to right
Left to right reduction
Right to left
Left to right and right most derivation in reverse
_____________________________________________________________________________________
Grammar of the programming is checked at ________ phase of compiler.

semantic analysis
code generation
syntax analysis
code optimization
_____________________________________________________________________________________
Which of the following is not an intermediate code form?

Postfix notation
Syntax trees
Three address codes
Quadruples
_____________________________________________________________________________________
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
_____________________________________________________________________________________
The graph that shows basic blocks and their successor relationship is called

DAG
Flow chart
Control graph
Hamiltonian graph
_____________________________________________________________________________________
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
_____________________________________________________________________________________
Which of the following is used for grouping of characters into tokens?

Parser
Code optimization
Code generator
Lexical analyzer
_____________________________________________________________________________________
An optimizer compiler

Is optimized to occupy less space


Is optimized to take less time for execution
Optimizes the code
None of these
_____________________________________________________________________________________
Pee hole optimization

Loop optimization
Local optimization
Constant folding
Data flow analysis
_____________________________________________________________________________________
The action of parsing the source program into proper syntactic classes is called

Syntax analysis
Lexical analysis
Interpretation analysis
General syntax analysis

Three address code involves


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

An intermediate code form is

Postfix notation
Syntax trees
Three address code
All 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
_____________________________________________________________________________________

Relocating bits used by relocating loader are specified by

Relocating loader itself


Linker
Assembler
Macro processor
_____________________________________________________________________________________

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
_____________________________________________________________________________________

Synthesized attribute can be easily simulated by a

LL grammar
Ambiguous grammar
LR grammar
None of the above
_____________________________________________________________________________________

The output of a lexical analyzer is

Machine code
Intermediate code
A stream of tokens
A parse tree
_____________________________________________________________________________________

Running time of a program depends on

The way the registers and addressing modes are used


The order in which computations are performed
The usage of machine idioms
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
_____________________________________________________________________________________

_________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
_____________________________________________________________________________________

Task of the lexical analysis

To parse the source program into the basic elements or tokens of the language
To build a literal table and an identifier table
To build a uniform symbol table
All of these
_____________________________________________________________________________________

Shift reduce parsers are

Top down parser


Bottom up parser
May be top down or bottom up parser
None of the above
_____________________________________________________________________________________

Any description error can be repaired by

Insertion alone
Deletion alone
Insertion and deletion alone
Replacement alone
_____________________________________________________________________________________

The linker

is similar to interpreter
uses source code as its input
is required to create a load module
none of the above
_____________________________________________________________________________________

A grammar that produces more than one parse tree for some sentence is called

Ambiguous
Unambiguous
Regular
None of these
_____________________________________________________________________________________

In an absolute loading scheme which loader function is accomplished by assembler ?

re-allocation
allocation
linking
loading
_____________________________________________________________________________________

Intermediate code generation phase gets input from

Lexical analyzer
Syntax analyzer
Semantic analyzer
Error handling
_____________________________________________________________________________________

We can optimize code by

Dead code elimination


Common subprograms
Copy intermediate loop
Loop declaration
_____________________________________________________________________________________

Code can be optimized at

Source from user


Target code
Intermediate code
All of the above
_____________________________________________________________________________________

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

Source language
Target language
Compiler
All of these
_____________________________________________________________________________________

YACC builds up

SLR parsing table


Canonical LR parsing table
LALR parsing table
None of the above
_____________________________________________________________________________________

Type checking is normally done during

Lexical analysis
Syntax analysis
Syntax directed translation
Code optimization
_____________________________________________________________________________________

A top down parser generates

Right most derivation


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

Which of the following does not interrupt a running process?


A device
Timer
Scheduler
Power failure
_____________________________________________________________________________________

In an absolute loading scheme, which loader function is accomplished by a loader ?

Re-allocation
Allocation
Linking
Loading
_____________________________________________________________________________________

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
_____________________________________________________________________________________

Which of the following can be accessed by transfer vector approach of linking?

External data segments


External subroutines
Data located in other procedure
All of these
_____________________________________________________________________________________

___________is a graph representation of a derivation.

The parse tree


The oct tree
The binary tree
None of the above
_____________________________________________________________________________________

The optimization which avoids test at every iteration is

Loop unrolling
Loop jamming
Constant folding
None of these
_____________________________________________________________________________________

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 parser with the valid prefix property is advantageous because it

Detects error as soon as possible


Detects errors as and when they occur
Limits the amount of erroneous output passed to the text phase
All of these
_____________________________________________________________________________________

Which of the following parser is most powerful?

Operator precedence
Canonical LR
LALR
SLR
_____________________________________________________________________________________

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
_____________________________________________________________________________________

Macro-processors are ______

Hardware
Compiler
Registers
None of the above
_____________________________________________________________________________________

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
_____________________________________________________________________________________

‘Macro’ in an assembly level program is _______.

sub program
a complete program
a hardware portion
relative coding
_____________________________________________________________________________________

The optimization technique which is typically applied on loops is

Removal of invariant computation


Peephole optimization
Constant folding
All of these
_____________________________________________________________________________________

Concept which can be used to identify loops is


Dominators
Reducible graphs
Depth first ordering
All of these
_____________________________________________________________________________________

Local and loop optimization in turn provide motivation for

Data flow analysis


Constant folding
Pee hole optimization
DFA and constant folding
_____________________________________________________________________________________

LR stands for

Left to right
Left to right reduction
Right to left
Left to right and right most derivation in reverse
_____________________________________________________________________________________

Grammar of the programming is checked at ________ phase of compiler.

semantic analysis
code generation
syntax analysis
code optimization
_____________________________________________________________________________________

Which of the following is not an intermediate code form?

Postfix notation
Syntax trees
Three address codes
Quadruples
_____________________________________________________________________________________

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
_____________________________________________________________________________________

The graph that shows basic blocks and their successor relationship is called

DAG
Flow chart
Control graph
Hamiltonian graph
_____________________________________________________________________________________

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
_____________________________________________________________________________________

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

Parser
Code optimization
Code generator
Lexical analyzer
_____________________________________________________________________________________

An optimizer compiler

Is optimized to occupy less space


Is optimized to take less time for execution
Optimizes the code
None of these
_____________________________________________________________________________________

Pee hole optimization

Loop optimization
Local optimization
Constant folding
Data flow analysis
_____________________________________________________________________________________

The action of parsing the source program into proper syntactic classes is called

Syntax analysis
Lexical analysis
Interpretation analysis
General syntax analysis

Three address code involves

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

An intermediate code form is

Postfix notation
Syntax trees
Three address code
All 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
_____________________________________________________________________________________

Relocating bits used by relocating loader are specified by

Relocating loader itself


Linker
Assembler
Macro processor
_____________________________________________________________________________________

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
_____________________________________________________________________________________

Synthesized attribute can be easily simulated by a

LL grammar
Ambiguous grammar
LR grammar
None of the above
_____________________________________________________________________________________

The output of a lexical analyzer is

Machine code
Intermediate code
A stream of tokens
A parse tree
_____________________________________________________________________________________

Running time of a program depends on

The way the registers and addressing modes are used


The order in which computations are performed
The usage of machine idioms
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
_____________________________________________________________________________________

_________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
_____________________________________________________________________________________

Task of the lexical analysis

To parse the source program into the basic elements or tokens of the language
To build a literal table and an identifier table
To build a uniform symbol table
All of these
_____________________________________________________________________________________
Shift reduce parsers are

Top down parser


Bottom up parser
May be top down or bottom up parser
None of the above
_____________________________________________________________________________________

Any description error can be repaired by

Insertion alone
Deletion alone
Insertion and deletion alone
Replacement alone
_____________________________________________________________________________________

The linker

is similar to interpreter
uses source code as its input
is required to create a load module
none of the above
_____________________________________________________________________________________

A grammar that produces more than one parse tree for some sentence is called

Ambiguous
Unambiguous
Regular
None of these
_____________________________________________________________________________________

In an absolute loading scheme which loader function is accomplished by assembler ?

re-allocation
allocation
linking
loading
_____________________________________________________________________________________

Intermediate code generation phase gets input from

Lexical analyzer
Syntax analyzer
Semantic analyzer
Error handling
_____________________________________________________________________________________

We can optimize code by

Dead code elimination


Common subprograms
Copy intermediate loop
Loop declaration
_____________________________________________________________________________________

Code can be optimized at

Source from user


Target code
Intermediate code
All of the above
_____________________________________________________________________________________

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

Source language
Target language
Compiler
All of these
_____________________________________________________________________________________

YACC builds up

SLR parsing table


Canonical LR parsing table
LALR parsing table
None of the above
_____________________________________________________________________________________

Type checking is normally done during

Lexical analysis
Syntax analysis
Syntax directed translation
Code optimization
_____________________________________________________________________________________

A top down parser generates

Right most derivation


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

Which of the following does not interrupt a running process?

A device
Timer
Scheduler
Power failure
_____________________________________________________________________________________

In an absolute loading scheme, which loader function is accomplished by a loader ?

Re-allocation
Allocation
Linking
Loading
_____________________________________________________________________________________
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
_____________________________________________________________________________________

Which of the following can be accessed by transfer vector approach of linking?

External data segments


External subroutines
Data located in other procedure
All of these
_____________________________________________________________________________________

___________is a graph representation of a derivation.

The parse tree


The oct tree
The binary tree
None of the above
_____________________________________________________________________________________

The optimization which avoids test at every iteration is

Loop unrolling
Loop jamming
Constant folding
None of these
_____________________________________________________________________________________

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 parser with the valid prefix property is advantageous because it

Detects error as soon as possible


Detects errors as and when they occur
Limits the amount of erroneous output passed to the text phase
All of these
_____________________________________________________________________________________

Which of the following parser is most powerful?

Operator precedence
Canonical LR
LALR
SLR
_____________________________________________________________________________________

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
_____________________________________________________________________________________

Macro-processors are ______

Hardware
Compiler
Registers
None of the above
_____________________________________________________________________________________

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
_____________________________________________________________________________________

‘Macro’ in an assembly level program is _______.

sub program
a complete program
a hardware portion
relative coding
_____________________________________________________________________________________

The optimization technique which is typically applied on loops is

Removal of invariant computation


Peephole optimization
Constant folding
All of these
_____________________________________________________________________________________

Concept which can be used to identify loops is

Dominators
Reducible graphs
Depth first ordering
All of these
_____________________________________________________________________________________

Local and loop optimization in turn provide motivation for

Data flow analysis


Constant folding
Pee hole optimization
DFA and constant folding
_____________________________________________________________________________________
LR stands for

Left to right
Left to right reduction
Right to left
Left to right and right most derivation in reverse
_____________________________________________________________________________________

Grammar of the programming is checked at ________ phase of compiler.

semantic analysis
code generation
syntax analysis
code optimization
_____________________________________________________________________________________

Which of the following is not an intermediate code form?

Postfix notation
Syntax trees
Three address codes
Quadruples
_____________________________________________________________________________________

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
_____________________________________________________________________________________

The graph that shows basic blocks and their successor relationship is called

DAG
Flow chart
Control graph
Hamiltonian graph
_____________________________________________________________________________________

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
_____________________________________________________________________________________

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

Parser
Code optimization
Code generator
Lexical analyzer
_____________________________________________________________________________________

An optimizer compiler

Is optimized to occupy less space


Is optimized to take less time for execution
Optimizes the code
None of these
_____________________________________________________________________________________

Pee hole optimization

Loop optimization
Local optimization
Constant folding
Data flow analysis
_____________________________________________________________________________________

The action of parsing the source program into proper syntactic classes is called

Syntax analysis
Lexical analysis
Interpretation analysis
General syntax analysis

Three address code involves

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

An intermediate code form is

Postfix notation
Syntax trees
Three address code
All 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
_____________________________________________________________________________________

Relocating bits used by relocating loader are specified by

Relocating loader itself


Linker
Assembler
Macro processor
_____________________________________________________________________________________

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy