Sample Paper of Compiler Design
Time taken=3 hours
Instructions:Attempt any Five questions selecting atleast one from each unit.All questions carry twenty marks each.
1. (a) Give the structure of a compiler and mention the phases of compiler.
Ans : Compilers are divided into many passes to save space.When each pass is finished, the compiler can free the space needed during that pass.
(b) What challenges are there in compiler design?
Ans : The major challenges in compiler design are it must be bug free, should generate correct machine code, must print diagnostics and error messages.
2. Explain the different types of parsers with related diagrams.
Ans : There are basically two types of parsers namely top-down parser and bottom up parser.
3. (a) What do you understand by intermediate code?
Ans. In many compilers the source programming code is translated into a language which is intermediate in complexity between a high level programming language and machine code. Such a language is therefore called intermediate code.
(b) Discuss the advantages of writing intermediate codes.
Ans. It is machine independent and performs efficient code generation.
4. (a) What are the different data structures in symbol tables?
Ans : The various data structures are lists, self-organising lists, trees and hash tables.
(b) Explain the concept of Block Structural Language and how does it affect a symbol table.
Ans : A Block Structural Language contains each program od subprogram organised as a set of nested blocks.
5. Explain Global Data Flow Analysis.
Ans : In Global Data Flow Analysis we analyze the flow of data from one block to another block of a program.
6. (a) What are the goals of Error Handler?
Ans : It should detect the presence of subsequent errors and produce meaningful diagnostics.
(b) Explain the classification of errors.
Ans : Lexical errors, syntactic errors, semantic errors, logical errors, other dynamic errors.
7. (a) What are the issues in design of a code generator?
Ans : Input to code generator, target program, instruction selection, register allocation and evaluation order are some of the issues in code generator.
(b) How can we generate code from a DAG?
Ans : We can generate code from DAG by rearranging order, heuristic ordering and labeling algorithm.
Tell us Your Queries, Suggestions and Feedback
3 Responses to Sample Paper of Compiler Design
« Sample Paper of Digital Electronics Sample Paper for Data Structure »
compilers and artificial intelligence
Compiler design is a tough subject, one must do practice.
This article is based on sample questions of compiler design. this can be helpful for the students.