Compiler Design & TOC Test - 5 - PDF Flipbook

Compiler Design & TOC Test - 5

282 Views
66 Downloads
PDF 2,515,635 Bytes

Download as PDF

REPORT DMCA


GATE
CSE

CompilerDesign
+

TheoryofComputation

Test-05Solutions


COMPILER DESIGN + THEORY OF COMPUTATION
1. 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) A Load-and-go assembler
c) Microprocessor
d) Compiler
Answer: (b)
2. System program such as compiler are designed so that they are
a) re-enterable
b) non-reusable
c) serially usable
d) recursive
Answer: (a)
3. 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: (c)

1


4. 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) Appears to execute a resource as if it were machine language.
Answer: (b)

5. 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: (d)

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

2


c) Accepts 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: (c)
7. loader 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 as object program.

d) Appears to execute a source program as if it were machine
language.

Answer: (a)
8. 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: (a)
9. Compiler can diagnose
a) grammatical errors only
b) logical errors only
c) grammatical as well as logical errors

3


d) neither grammatical nor logical errors
Answer: (a)
10. A programmer, by mistake, writes an instruction to divide,
instead of a multiply, such error continue detected by Alan
a) compiler
b) interpreter
c) compiler or interpreter test
d) none of these
Answer: (a)
11. A series of statements explaining how the data is to be
processed is called
a) assembly
b) machine
c) pascal
d) program
Answer: (d)
12. The computer language generally translated to pseudocode is
a) assembly
b) machine
c) pascal
d) PL I I
Answer: (a)

4


13. 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: (a)

14. A system program that setup an executable program in main
memory ready for execution to:
a) assembler
b) linker
c) loader
d) load and go
Answer: (c)

15. 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) load and go
Answer: (b)

16. Advantage of using assembly language rather than ~ machine
language is that
a) it is mnemonic and easy to read
b) addresses any symbolic not absolute

5


c) introduction of data to program is easier
d) all of these
Answer: (d)
17. Advantage of incorporating the macro-processor into pass I is
that
a) many functions do not have to be implemented
b) Twice 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: (d)
18. 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: (d)

6


19. In an absolute loading scheme, which loader function is
accomplished by programmer?
a) Allocation
b) Linking
c) Reallocation
d) Both (a) and (b)
Answer: (d)

20. 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 tokens 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: (c)

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

7


c) Consists 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 key words and special
symbols of the language in symbolic form.

Answer: (d)
22. Which of the following is a phase of a compilation process?

a) Lexical analysis
b) (b) Code generation
c) Both (a) and (b)
d) None of these
Answer: (c)
23. Resolution is externally defined symbols is performed by
a) Linker
b) Loader
c) Compiler
d) Assembler
Answer: (a)
24. 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. l'
d) All of these
Answer: (d)

8


25. 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: (c)

26. Access time of the symbol table will be logarithmic, if it is
implemented by
a) linear list
b) search tree
c) hash table
d) self-organization list
Answer: (b)

27. Recursive descent parsing is an example of
a) top-down parsers
b) bottom-up parsers
c) predictive parsing
d) none of these
Answer: (b)

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

9


d) none of these
Answer: (a)
29. LR parsers are attractive because
a) it can be constructed to recognize CFG corresponding to

almost all programming on struct
b) it does not backtrack
c) both (a) and (b)
d) none of these

Answer: (d)
30. The most powerful parser is

a) SLR
b) LALR
c) Canonical LR
d) Operator-precedence
Answer: (c)

10


Data Loading...