MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
a regular language can be specified by
A
regular expression
B
regular grammar
C
both
D
none
Explanation: 

Detailed explanation-1: -A language is a regular language if there is a finite automaton that recognizes it. For example, this machine recognizes the language of strings that have an even number of zeroes since any string that has an even number of zeroes will go from the start state to an accepting state.

Detailed explanation-2: -To prove a language is regular: construct a DFA, NFA or RE that recognizes it. To prove a language is not regular: show that recognizing it requires keeping track of infinite state (hard to be completely convincing in most cases) or use the pumping lemma to get a contradiction.

Detailed explanation-3: -Note:A regular expression is not unique for a language. That is, a regular language, in general, corresponds to more than one regular expressions. For example ( a + b )* and ( a*b* )* correspond to the set of all strings over the alphabet a, b.

There is 1 question to complete.