Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Compiler Construction Question Paper

Compiler Construction 

Course:Bachelor Of Science In Information Technology

Institution: Kca University question papers

Exam Year:2010



UNIVERSITY EXAMINATIONS: 2009/2010
THIRD YEAR EXAMINATION FOR THE DEGREE OF BACHELOR OF
SCIENCE IN INFORMATION TECHNOLOGY
BIT 3104: COMPILER CONSTRUCTION
DATE: APRIL 2010 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions
QUESTION ONE
a) Give two points explaining how the knowledge of compiler construction impacts the following
i. Data structures
ii. Theory of computation
iii. Computer architecture
[6 Marks]
b) Give FOUR features of a good compiler [2 Marks]
c) The structure of a compiler is characterized by two major parts; Front End and Back End.
Describe the functions of each of them [2 Marks]
d) Why do you think OPTIMIZATION as regards compiler construction is Key to a good
compiler? Give TWO points to explain your answer. [4 Marks]
e) Given the following Grammar
G = (N, T, R, S) where
N = {S}
T ={ (, ) }
R ={ S? (S) , S?SS, S?e }
i. Derive the sentence of nested parenthesis
ii. Define what a sentential form is
iii. Describe what you understand by the term leftmost derivation
[6 Marks]
f) i) Given S ? if E then S else S | if E then S, draw the parse trees associated
with parsing the sentence if E then if E then S else S henceforth define the term
ambiguity [4 Marks]
ii) Illustrate how you can eliminate ambiguity in the above sentence [3 Marks]
g) i) Define Left Recursion
ii) Given the following sentence A ? Aa1 | Aa2 | ... | Aam | ß1 | ß2 | ... | ßn,
rewrite it eliminating direct recursion [3 Marks]
QUESTION TWO
a) Given the following grammar
S = A B | S A B.
A = a | a a b.
B = b | b b a.
Use it to pass the following input string
a b b a a b # (# represent the end of file) [6 Marks]
a) In the context of compiler construction and in particular, syntax analysis define the following terms
i). Recognition
ii). Parsing
iii). Unambiguous grammar:
[6 Marks]
b) Differentiate between bottom-up and top-down parsing [4 Marks]
c) Describe the recursive descent parser and the main Idea behind it [4 Marks]
QUESTION THREE
a) Differentiate between name equivalence and structural equivalence [4 Marks]
b) State the information found in the symbol table [5 Marks]
c) What is the function of the hash table? Give an example to illustrate your answer. [4 Marks]
d) Briefly discuss three storage allocation techniques [6 Marks]
e)Define the term scope [1 Mark]
QUESTION FOUR
a) Scanning and Parsing are usually separated in the context of compiler construction. Give two reasons why scanning is not part of parsing? [4 Marks]
b) i) Define the grammar of letters and that of digits using normal English
language [4 Marks]
ii) Give the definition of an Identifier [2 Marks]
c) Given the following grammar, transform it to regular grammar
E = T { "+" T }.
T = F { "*" F }.
F = id. [4 Marks]
d) Explain why the following grammar is not regular
E = F { "*" F }.
F = id | "(" E ")". [4 Marks]
e) Explain one limitation of regular grammar [2 Marks]
QUESTION FIVE
a) Define the phrase syntax-directed translation. [2 Marks]
b) Redundancy elimination is done by determining that two computations are equivalent and
eliminating one. Describe FOUR types of Redundancy Elimination [8 Marks]
c) The Goal for fast execution of a program is to store as much data as possible in registers. This however has limitations. Describe Two limitations/considerations [4 Marks]
d) Describe SIX typical information that is stored in Stack frames [6 Marks]






More Question Papers


Popular Exams



Return to Question Papers