Compiler Design MCQs
This section focuses on "Basics" in Compiler Design. These Multiple Choice Questions (MCQs) should be practiced to improve the Compiler Design skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. How many alphabets are there in Binary language?
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : A
Explanation: nary language has only two alphabets, 0 and 1.
2. we write programs in?
A. Low-Level Language
B. Middle-Level Language
C. High-Level Language
D. Decimal-Format
View Answer
Ans : C
Explanation: we write programs in high-level language, which is easier for us to understand and remember.
3. _______ is a program that converts high-level language to assembly language.
A. assembler
B. compiler
C. interpreter
D. linker
View Answer
Ans : B
Explanation: A compiler is a program that converts high-level language to assembly language.
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
View Answer
Ans : A
Explanation: A compiler that runs on platform (A) and is capable of generating executable code for platform (B) is called a cross-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
View Answer
Ans : B
Explanation: A linker tool is used to link all the parts of the program together for execution (executable machine code).
6. Which of the following tool produces input for compilers?
A. Interpreter
B. Assembler
C. Loader
D. Preprocessor
View Answer
Ans : D
Explanation: A preprocessor, generally considered as a part of compiler, is a tool that produces input for compilers. It deals with macro-processing, augmentation, file inclusion, language extension, etc.
7. Does compiler reads the whole source code at once?
A. Yes
B. No
C. Depends on compiler
D. Don't know
View Answer
Ans : A
Explanation: A compiler reads the whole source code at once, creates tokens, checks semantics, generates intermediate code, executes the whole program and may involve many passes
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
View Answer
Ans : B
Explanation: If an error occurs, an interpreter stops execution and reports it.
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
View Answer
Ans : C
Explanation: a compiler reads the whole program even if it encounters several errors.
10. The output of an assembler is called?
A. data file
B. task file
C. object file
D. program file
View Answer
Ans : C
Explanation: An assembler translates assembly language programs into machine code.The output of an assembler is called an object file, which contains a combination of machine instructions as well as the data required to place these instructions in memory.
Discussion