Compilers Multiple Choice Questions & Answers (MCQs) on “Data Structure for Representing Parsing Table”.
1. Compiler can diagnose __________
a) Grammatical errors only
b) Logical errors only
c) Grammatical and logical errors
d) None of the mentioned
Answer: a
Clarification: Only syntactical errors can be detected by the compiler.
2. A simple two-pass assembler does which of the following in the first pass?
a) It allocates space for the literals
b) Calculates total length of the program
c) Symbol table is built for the symbols and their value
d) All of the mentioned
Answer: d
Clarification: A two-pass assembler. Each pass scans the program, the first pass generates the symbol table and the second pass generates the machine code.
3. A system program that set-up an executable program in the main memory ready for execution is?
a) Assembler
b) Linker
c) Loader
d) Text editor
Answer: c
Clarification: A loader is the part of an operating system that is responsible for loading programs and libraries. It is important that with the starting of a program, as it places programs into memory and executes it.
4. A compiler is a program that ___________
a) Program is put into memory and executes it
b) Translation of assembly language into machine language
c) Acceptance of a program written in a high level language and produces an object program
d) None of the mentioned
Answer: c
Clarification: A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code).
5. A programmer by mistake writes multiplication instead of division, such error can be detected by?
a) Compiler
b) Interpreter
c) Compiler or interpreter test
d) None of the mentioned
Answer: d
Clarification: No Logical errors can be detected.
6. The computer language generally translated to pseudocode is ___________
a) Assembly
b) Machine
c) Pascal
d) FORTRAN
Answer: a
Clarification: An assembly language (or assembler language) is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture’s machine code instructions.
7. 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 the mentioned
Answer: b
Clarification: A loader which combines the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled into an executable program.
8. In which way a macro processor for assembly language can be implemented?
a) Independent two-pass processor
b) Independent one-pass processor
c) Processor put into pass 1 of a standard two pass assembler
d) All of the mentioned
Answer: d
Clarification: A general-purpose macro processor or general purpose preprocessor is a macro designed for string manipulation, macro definition.
9. Resolution of externally defined symbols is performed by ___________
a) Linker
b) Loader
c) Compiler
d) Interpreter
Answer: a
Clarification: A linker or link editor is a computer program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another object file.
10. A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar 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: a
Clarification: Initially 2 is printed then 3 then 1 3 1.