Sunteți pe pagina 1din 2

Paper B

Name: ______________________ Roll No. : _______________ Invigilator Signature ____________

GC University Faisalabad Layyah Campus


Department of Computer Science

Course Code: CSI-562 Course Name: Theory of Automata and Formal Lnguages Term: Final
Time Allowed: 1:40 min Marks: 20 Class: BSCS 5th Semester

Q. 2. a) Write down the elements of Chomsky hierarchy 04

b) What is “Ambiguous Grammar”. Consider the following Grammar 04

1. L → a | b | La | Lb | L0 | L1
2. F → L | (E)
3. T → F | T ∗ F
4. E → T | E + T

Above Grammar is Ambiguous or Not for string a+a*a? Show from parse Tree.

Q. 3.a) What is Mealy Machine? Construct Mealy machine for adding binary numbers. 2+2=04

b) . Define the following. 2+2=04

1. P?DA 2. Palindrom

c) Construct union of following two regular expression 04

“Best of Luck”
Paper B

Name: ______________________ Roll No. : _______________ Invigilator Signature ___________

GC University Faisalabad Layyah Campus


Department of Computer Science

Course Code: CSI-562 Course Name: Theory of Automata and Formal Lnguages Term: Final
Time Allowed: 10 min Marks: 10 Class: BSCS 5th Semester

Q. no.1 Chose Correct Answer.


i) ------------------- is obviously infinite language.
A) EQUAL-EQUAL B) PALINDROME C) EVEN-EVEN D) FACTORIAL

ii) L= language of words containing even number of a’s. Regular Expression is

A) (a+b)aa(a+b) B) (b+aba) C) a+bbaaba D) (a+b)ab(a+b)

iii) ___________ states are called the halt states.

A) ACCEPT and REJECT B) ACCEPT and READ C) ACCEPT AND START D) ACCEPT AND WRITE

iv) The symbols that can’t be replaced by anything are called -----------------
A) Productions B) Terminals C) Non-terminals D) All of above

v) The symbols that must be replaced by other things are called __________
A) Productions B) Terminals C) Non-terminals D) All of above

Vi) The grammatical rules are often called_____________


A) Terminals B) Productions C) Non-terminals D) All of above

vii) The terminals are designated by ________ letters, while the non-terminals are designated by
________ letters.
A) Capital, bold B) Small, capital C) Capital, small D) Small, bold

viii) The language generated by __________ is called Context Free Language (CFL).
A) FA B) CFG C) TG D) TGT

Ix Σ = {a,b} Productions S→XaaX X→aX X→bX X→Λ


This grammar defines the language expressed by___________
A) (a+b)aa(a+b) B) (a+b)a(a+b)a C) (a+b)aa(a+b)aa D) (a+b)aba+b)

X A language accepted by an FA is also accepted by


A) TG only B) GTG only C) RE only D) All of the given

“Best of Luck”

S-ar putea să vă placă și