Compiler Design Question Paper
Compiler Design
Course:Bachelor Of Science Computer Science
Institution: Masinde Muliro University Of Science And Technology question papers
Exam Year:1013
MASINDE MULIRO UNIVERSITY OF
SCIENCE AND TECHNOLOGY
(MMUST)
THIRD YEAR SECOND SEMESTER EXAMINATION
FOR THE DEGREE OF BSC
IN COMPUTER SCIENCE
COURSE CODE: CSC320
COURSE TITLE:COMPILER DESIGN
DATE 30TH APRIL 2013 TIME 2.00pm-5.00pm
Instruction to candidates
Answer QUESTION ONE in SECTION A
Answer ANY OTHER TWO in SECTION B.
SECTION A(COMPULSORY)
QUESTION ONE(30MARKS)
a)What is compiler?What are phases of Compilation?(5marks)
b)Explain the front end and back end compiler.(5marks)
c)What is meant by lexical analysis?Explain task of lexical analyzer.(5marks)
d))What is meant by syntax analysis?Explain task of parser.(5marks)
e) Define grammar.How does grammar specify a language?(5marks)
f)Define Chomsky''s classification of grammars.(5marks)
SECTION B(Answer ANY TWO QUESTIONS in this section)
QUESTION TWO(20MARKS)
a)Define lexical analysis problem(5marks)
b)How do we construct a push down machine to top down parse the language of a given grammar?(5marks)
c)Write regular expression for all strings of zero and ones which begin with 1 and end with a 0.(5marks)
d)Show sequence of stacks for push down machine which parse the string abbaddd with the following grammar(5marks)
1.S-aSB
2.S-b
3.S-a
4.S-bBa
QUESTION THREE(20MARKS)
a)Define parsing problem(5marks)
b)How do we top down parse simple languages with push down machine(5marks)
c)Write a regular expression for all strings of as and bs which contain the substring aba(5marks)
d)Contruct a push down automata to accept the language of the following grammar.(5marks)
1.S-0S10A
2.S-11AA
3.A-0S1
4.A-1
QUESTION FOUR(20MARKS)
a)Define the non-deterministic finite automaton.(5marks)
b)How do we construct a push down machine to top down parse the language of a given grammar?(5marks)
c)Show the reflexive transitive closure of the following relation(R1)(5marks)
R1
(a,b)
(c,d)
(b,a)
(b,c)
(c,c)
d)Show the sequence of stacks for the push down machine which shift reduce parses the string caabaab with the following grammar.(5marks)
1.S-SaB
2.S-c
3.B-ab
More Question Papers
Exams With Marking Schemes