Full Text
Full Text
Faculty o f
Computing
UNIVERSITITEKNOLOGI MALAYSIA
FINAL EXAMINATION SEMESTER 1 , 2017 / 2018
SECTION : ALL
INSTRUCTIONS:
(Please Write Your Lecture Name And Section In Your Answer Booklet)
Name
I/C No.
Year/Course
Section
Lecturer Name
This questions paper consists of ELEVEN ( 1 1) printed pages including this page.
STRUCTURED QUESTIONS [100 marks]
Answer all the questions.
Generate the context free grammar, C F G (that is not regular grammar) according to each
following language, L(G) or regular expression.
2
Question 2 [10 marks]
(c) Build the derivation tree for the derivation in parts (a) and (b) [4 marks]
3
Question 3 [10 marks]
Generate the Regular grammar (RG) according to the each following context free grammar
(CFG).
a) S —>aBa [2 marks]
B —>bB I A,
b) S —» AB [2 marks]
A —>aA | X
B -* bB I X
c) S —*AS [2 marks]
A —>ab
d) S —>aA [2 marks]
A —>aA I bA I X
4
Question 4 [10 marks]
Generate the regular grammar according to the each following regular expression,
a) b*ab*ab*a [2 marks]
b) a*b(bb)*aa* [3 marks]
c) (a*ab*)* [2 marks]
d) (aa*(ab+a)*) [3 marks]
Question 5 [10 marks]
(a) Trace the computation for the input string aabca. [2 marks]
7
(b) Trace the computation for the input string bcbc. [2 marks]
(c) Design a Turing Machine to recognize all strings in which ‘010’ is present as substring
[3 marks]
9
Question 9 [10 marks]
(a) Design a Turing Machine that accepts the language L(M) [5 marks]
(b) Trace a computation of the Turing Machine that process a string aaabbcccc [4 marks]
(c) What is the shortest string in the language L(M) that accepted by the machine. [1 mark]
10
Question 10 [10 marks]
The table shows the 4 types of grammars in the Chomsky hierarchy. Fill up the blank fields
in the table below.
Table 1
Example** of Production rules
Type Grammar Languages Automaton Example of language L
(refer to the note below)
Recursively
Type-0
enumerable
Linear-bounded non-
Context-
Type-1
sensitive
deterministic Turing {a’V b ” | m 2 0}
machine
S -» aSb | X
Type-2 Context-free
A —> c A d |X
S —►aS | A.
Type-3 Regular Finite automata A-»aA|a {b’V | m, n £ 0}
B -> bB | b
END OF QUESTIONS