0% found this document useful (0 votes)
482 views

Compiler Design MCQ Questions PDF

This document contains a set of 30 multiple choice questions about compiler design topics like lexical analysis, parsing, syntax analysis and code generation. The questions cover phases of the compiler, tools used in compilation like scanners, parsers and linkers. Grammars, derivations and parsing techniques are also addressed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
482 views

Compiler Design MCQ Questions PDF

This document contains a set of 30 multiple choice questions about compiler design topics like lexical analysis, parsing, syntax analysis and code generation. The questions cover phases of the compiler, tools used in compilation like scanners, parsers and linkers. Grammars, derivations and parsing techniques are also addressed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Compiler Design MCQ Questions PDF

1. Which of the following component is important for semantic analysis?

1. Lex
2. Symbol Table
3. Yacc
4. Type Checking

Answer: Type checking

2. Which of the following parser is a top-down parser?

1. A LR parser
2. Recursive descent parser
3. An LALR parser
4. Operator precedence parser

Answer: Recursive descent parser

3. Which phase of the compiler is also known as Parser?

1. Semantic Analysis
2. Code Optimization
3. Syntax Analysis
4. Lexical Analysis

Answer: Syntax Analysis

4. Which phase of the compiler is also known as Scanner?

1. Lexical Analysis
2. Semantic Analysis
3. Syntax Analysis
4. Code generation

Answer: Lexical Analysis

5. Which parser is most powerful in the following parsers?

1. SLR
2. Operator Precedence
3. Canonical LR
4. LALR

Answer: Canonical LR

6. Keywords are recognized in a compiler during ____________

1. the code generation


2. the lexical analysis of the program
3. the data flow analysis
4. the program parsing

Answer: the lexical analysis of the program

7. Users write the programs in which language?

1. High-Level Language
2. Decimal-Format
3. Low-level Language
4. Middle-Level Language

Answer: High-Level Language

8. Which of the following is not a characteristic of the compiler?

1. Firstly scans the entire program and then transforms it into machine-understandable
code
2. The execution takes place after the removal of all syntax errors
3. More execution time
4. Debugging process is slow

Answer: More execution time

9. Which derivation is generated by the bottom-up parser?

1. Left-most derivation in reverse


2. Right-most derivation
3. Right-most derivation in reverse
4. Left-most derivation

Answer: Right-most derivation in reverse

10. The output of the lexical analyzer is _______

1. a syntax tree
2. a set of RE
3. string character
4. a set of tokens

Answer: a set of tokens

11. Which phase of the compiler checks the grammar of the programming?

1. Semantic Analysis
2. Syntax Analysis
3. Code Optimization
4. Code Generation
Answer: Syntax Analysis

12. Which computer program accepts the high-level language and converts it into
assembly language?

1. Linker
2. Assembler
3. Interpreter
4. Compiler

Answer: Compiler

13. Which part of the compiler highly used the grammar concept?

1. Code generation
2. Parser
3. Code optimization
4. Lexical Analysis

Answer: Parser

14. From the following grammars, which describes the lexical syntax?

1. Context-free Grammar
2. Syntactic Grammar
3. Lexical Grammar
4. Regular Grammar

Answer: Lexical Grammar

15. Which derivation is generated by the top-down parser?

1. Left-most derivation in reverse


2. Right-most derivation in reverse
3. Left-most derivation
4. Right-most derivation

Answer: Left-most derivation

16. Which of the following file is an output of the assembler?

1. Task File
2. Data File
3. Program file
4. Object file

Answer: Object File

17. Which grammar gives multiple parse trees for the same string?
1. Regular
2. Ambiguous
3. Unambiguous
4. None of above

Answer: Ambiguous

18. In which parsing, the parser constructs the parse tree from the start symbol and
transforms it into the input symbol

1. Top-down parsing
2. Bottom-up parsing
3. All of above
4. None of above

Answer: Top-Down Parsing

19. Which is considered as the sequence of characters in a token?

1. Lexeme
2. Mexeme
3. Texeme
4. Pattern

Answer: Lexeme

20. Which compiler runs on one machine and generates code for multiple machines?

1. Onepass compiler
2. Optimizing compiler
3. Multipass compiler
4. Cross compiler

Answer: Cross compiler

21. Which tool is used for grouping of characters in tokens in the compiler?

1. Code optimizer
2. Code generator
3. Parser
4. Scanner

Answer: Scanner

22. Leaf nodes in a parse tree indicate?

1. half-terminals
2. sub-terminals
3. non-terminals
4. terminals
Answer: terminals

23. In Compiler lexical analyzer is used for?

1. removing whitespace
2. breaking the syntaxes in the set of tokens
3. removing comments
4. All of the above

Answer: All of the above

24. The value of which variable is updated inside the loop by a loop-invariant value?

1. invariable
2. induction
3. strength
4. loop

Answer: induction

25. What is the linker?

1. It is required to create the load module


2. It is the same as the loader
3. It is always used before the program execution
4. None

Answer: It is required to create the load module

26. Which graph describes the basic block and successor relationship?

1. DAG
2. Flow graph
3. Control graph
4. Hamilton graph

Answer: Flow graph

27. The most general phase of structured grammar is?

1. Context-free grammar
2. Regular grammar
3. Context-sensitive grammar
4. All of above

Answer: Context Sensitive Grammar

28. Which language is accepted by the push-down automata?

1. Type 1 language
2. Type 2 language
3. Type 0 language
4. Type 3 language

Answer: Type 2 language

29. In the compiler, the function of using intermediate code is_____________

1. to increase the error reporting & recovery


2. to make semantic analysis easier
3. to increase the chances of re-using the machine-independent code optimizer in other
compilers
4. to improve the register allocation

Answer: to increase the chances of re-using the machine-independent code optimizer in


other compilers

30. Parsing is categorized into how many types?

1. four types
2. five types
3. three types
4. two types

Answer: two types

You might also like