Compiler Design
MCQ questions and answers
- 4.5/5.0
- 1k Enrolled
- All levels
- Last updated 11/2023
- English
Compiler Design MCQ (49)
1. | Which code is known as machine code which is processed or executed by the processor? |
A | Source code |
B | Object code |
C | MSIL code |
D | Byte Code |
Answer: B | |
2. | Low level language is also called as __________. |
A | Machine language |
B | Binary language |
C | A and B are same |
D | High level language |
Answer: C | |
3. | Which programming language uses the symbolic codes for the program? |
A | Machine language |
B | Low level language |
C | High level language |
D | Assembly language |
Answer: D | |
4. | Which programming language uses the constraint rather than an algorithm? |
A | SQL |
B | C++ |
C | Assembly |
D | PROLOG |
Answer: D | |
5. | Which program is used to create a source file? |
A | Editor |
B | Translator |
C | Compiler |
D | Interpreter |
Answer: A | |
6. | Which program is known as a translator, which reads the whole code written in high-level language at once and then converts it into the machine code? |
A | Editor |
B | Linker |
C | Compiler |
D | Interpreter |
Answer: C | |
7. | _____ translator program is used to convert the high-level language code into the machine code using line by line conversion? |
A | Linker |
B | Editor |
C | Compiler |
D | Interpreter |
Answer: D | |
8. | Which program combines the two or more object modules into the single object module or into an executable file? |
A | Linker |
B | Interpreter |
C | Assembler |
D | Compiler |
Answer: A | |
9. | Which program is also called as loader? |
A | Interpreter |
B | Linker |
C | Javac |
D | Compiler |
Answer: B | |
10. | Generally _______ is a considered as part of the compiler which produces an input for the compilers. |
A | linker |
B | loader |
C | preprocessor |
D | processor |
Answer: C | |
11. | Which code file has extension “O” in the unix system? |
A | Source code |
B | C language program |
C | Object code |
D | Binary code |
Answer: C | |
12. | Machine language was used in a __________ generation of computers. |
A | First |
B | Third |
C | Fourth |
D | Fifth |
Answer: A | |
13. | Which program is used to translate the low-level language code into a high-level language code? |
A | Parse generator |
B | Decompiler |
C | Cross compiler |
D | Scanner |
Answer: B | |
14. | __________ program is used translate the machine code into the assembly code. |
A | Parse generator |
B | Scanner |
C | Disassembler |
D | Cross compiler |
Answer: C | |
15. | Which compiler is used to convert the high-level code into machine-level code? |
A | General compiler |
B | Cross compiler |
C | Native code compiler |
D | JIT compiler |
Answer: A | |
16. | Which compiler is used to test the new hardware platform? |
A | Cross compiler |
B | Native code compiler |
C | Source to source compiler |
D | JIT compiler |
Answer: A | |
17. | Which compiler comes with a by default virtual machine and it is optional? |
A | Cross compiler |
B | Multipass compiler |
C | One pass compiler |
D | JIT compiler |
Answer: D | |
18. | Native code is also called as __________. |
A | C-code |
B | O-code |
C | P-code |
D | Byte Code |
Answer: C | |
19. | ____ is the type of compiler that passes through the part of each compilation unit exactly once. The single-pass compiler is faster and smaller than the multi-pass compiler. |
A | One pass compiler |
B | JIT |
C | Interpreter |
D | Parser |
Answer: A | |
20. | Which compiler is the faster? |
A | Single pass |
B | Multipass |
C | Narrow |
D | None |
Answer: A | |
21. | ______ breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code. |
A | Parser |
B | Lexical analyzer |
C | Scanner |
D | B and C are same |
Answer: D
Description: Lexical analysis is the first phase of a compiler. It takes the modified source code from language preprocessors that are written in the form of sentences. The lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code. |
|
22. | _____ is a sequence of characters in the source program that matches the pattern for a token and is identified by the lexical analyzer as an instance of that token. |
A | Intermediate code |
B | Stream |
C | Lexemes |
D | Semantic |
Answer: C | |
23. | The syntactical analyzer is also called __________. |
A | lexemes |
B | parser |
C | lexical analyzer |
D | scanner |
Answer: B | |
24. | ____ is the third phase of the Compiler which is used to make sure that declarations and statements of the program are semantically correct |
A | Lexical analysis |
B | Parser |
C | Semantic analysis |
D | Syntactical analyzer |
Answer: C | |
25. | ______ is a program transformation technique, which tries to improve the code by making it consume fewer CPU resources and deliver high speed. |
A | Intermediate code generator |
B | Code generator |
C | Interpreter |
D | Code optimizer |
Answer: D | |
26. | _____ is the process which converts some intermediate representation of source code into a machine code that can be readily executed by a machine. |
A | Interpretation |
B | Semantic analysis |
C | Code generation |
D | Code optimization |
Answer: C | |
27. | Which programming language uses the compiler as well as interpreter to produce final output? |
A | C language |
B | C++ |
C | Cobol |
D | Java |
Answer: D | |
28. | ______ an important data structure created and maintained by the compiler in order to keep track of semantics of variable. |
A | Lookup table |
B | Symbol table |
C | Inode table |
D | Tree |
Answer: B | |
29. | Which tool is used to develop the compiler? |
A | Compiler – Compiler |
B | Compiler – generator |
C | NELIAC |
D | A and B is same |
Answer: D | |
30. | _____ is a set of recursive rules used to generate patterns of strings. |
A | Context-free grammar |
B | Pragmas |
C | Significant comments |
D | Lexical analyzer |
Answer: A | |
31. | _______ preprocessor directive is used to provide additional information to the compiler. |
A | #pragma |
B | header files |
C | linker |
D | loader |
Answer: A | |
32. | the bootstrapping technique is also called as __________ in compiler design. |
A | parser |
B | self-hosting |
C | NELIAC |
D | none of these |
Answer: B | |
33. | _____ process of modifying an existing compiler to work on a new machine architecture. |
A | bootstraping |
B | translation |
C | porting |
D | transformation |
Answer: C | |
34. | ______ is the process of finding and resolving defects or problems within a computer. |
A | Profiling |
B | Debugging |
C | Loading |
D | Preprocessing |
Answer: B | |
35. | ________ is a compiler that is used to break the data into the smaller elements coming from the lexical analysis phase. |
A | linker |
B | loader |
C | parser |
D | preprocessor |
Answer: C | |
36. | _______ is called a lexical analysis which is a first phase of the compiler. |
A | Parallel analysis |
B | Linear analysis |
C | Parser |
D | Token |
Answer: B | |
37. | __________ expressions are widely used to specify the lexical pattern. |
A | Regular |
B | Mathematical |
C | String |
D | Prefix |
Answer: A | |
38. | Which operation is used to searching a lexical entry in the symbol table? |
A | Insert |
B | Lookup |
C | Select |
D | Scanner |
Answer: B | |
39. | ______ is the second phase of the compiler which is also called as parsing. |
A | Debugging |
B | Scanning |
C | Syntax analysis |
D | Semantic analysis |
Answer: C | |
40. | A lexical analyzer is used filter out __________ and __________. |
A | comment, keyword |
B | whitespace, comment |
C | character, number |
D | operator, operand |
Answer: B | |
41. | ____ is an abstract symbol representing a kind of lexical unit. |
A | Token |
B | keyword |
C | pattern |
D | Data type |
Answer: A | |
42. | Which kind of relationship exists between the lexical analyzer and parser? |
A | Producer – Consumer |
B | Teacher – Student |
C | Has – a |
D | Association |
Answer: A | |
43. | ______ is a sequence of characters in the source program that matches the pattern for a token and is identified by the lexical analyzer as an instance of that token. |
A | Keyword |
B | Token |
C | Pattern |
D | Lexeme |
Answer: D | |
44. | The lexical analyzer scans the input from ________ one character at a time. |
A | right to left |
B | left to right |
C | center |
D | none |
Answer: B | |
45. | __________ is a finite sequence of the symbol. |
A | string |
B | word |
C | A and B are same |
D | language |
Answer: C | |
46. | _____ creates an equivalent target program from the intermediate representation. |
A | Synthesis phase |
B | Analysis phase |
C | All of the above |
D | None of the above |
Answer: A | |
47. | How many types of formal language classes according to Noam Chomsky? |
A | Two |
B | Three |
C | Four |
D | Five |
Answer: C | |
48. | ______ is the general approach used in shift-and-reduce parsing. |
A | parse generator |
B | handle pruning |
C | bottom parsing |
D | handle |
Answer: B | |
49. | Which is/ are the parse generator? |
A | Yacc |
B | Visual parse++ |
C | Grammatica |
D | All of the above |
Answer: D |