Push Down Automata &
Turing Machine (Unit-4)
Multiple Choice Questions (MCQ)
1) A Symbol Table in a Compiler is mainly used to: (i) Store Keywords (ii) Store Identifiers and their Attributes (iii) Generate Machine Code (iv) Perform Lexical Analysis
2) When can semantic errors be detected? (i) During Compile Time (ii) During Run Time (iii) Both (i) and (ii) (iv) None of the above
3) Which of the following mechanism is used to associate meaning (semantic information) with a Context Free Grammar (CFG)? (i) Syntax Directed Definition (ii) Parse Table (iii) Left Recursion (iv) Token Stream
4) Symbol Tables are mainly used during which phase of Compilation? (i) Syntax Analysis (ii) Semantic Analysis (iii) Code Generation (iv) Code Optimization
5) Which Data Structure is commonly used to implement a Symbol Table? (i) Queue (ii) Stack (iii) Hash Table (iv) Tree
6) Which of the following are stored in a Symbol Table? (i) Variable Name (ii) Data Type (iii) Memory Location (iv) All the above
7) Average expected lookup time for a given key in a hash-table based Symbol Table is: (i) O(log n) (ii) O(n) (iii) O(1) (iv) None of the above
8) Average expected lookup time for a given key in a hash-table based Symbol Table is: (i) O(log n) (ii) O(n) (iii) O(1) (iv) None of the above
Descriptive Questions
Q1. Explain different steps involved in a typical language processing system with a neat diagram.
Q2. Identify the difference between compiler & assembler. Retrieve the phases of a typical compiler?
Q3. Tabulating the difference between lexemes, patterns and tokens. How do you recognize tokens in Lexical Analysis?
Q4. Define token? Explain how Finite automata is used to recognize tokens in a program?
Q5. List out the phases of compiler? What is the role of lexical analysis in constructing a compiler?
Q6. Explain the concept of a “pass” in compiler design. How do multiple passes contribute to the overall translation process?
Q7. Discuss the contents and structure of a symbol table. What types of information are stored for each identifier?
Q8. What is a symbol table. What role does the parser play in the overall compilation process?
Q9. Consider the following Conditional statement:
if (x > 3) then y = 5 else y = 10;
Explain how does a lexical analyzer help the above statement in the process of compilation?
Q10. Recognize the LEX tools available for compiler constrction with an example.
Q11. Write the structure and syntax of LEX-Lexical Analyzer Generators.
Q12. Compare and contrast compiler writing from scratch with using a scanner generator like LEX (Lexical Analyzer Generator).
Q13. Explain the translation process at each phase of compiler for the given expression d:=b+c*60
Q14. What is LEX? Explain the importance of LEX tool with an example?
Q15. Briefly describe the two main classifications of parsers: top-down and bottom-up parsing.
Q16. Draw the syntax tree for the following expression:
(a+(b*c)^d-e)/(f+g)
Q17. Construct Syntax tree to evaluate the expression 2+3*4, through SDD.
S-->CC C-->aC C-->d
Q19. Construct a LALR parsing table for the grammar:
S-->Aa | bAc | dc | bda A-->a

.png)
.png)
.png)
.png)


.png)











.png)









