โ˜‘ MCQ PRACTICE

Formal Languages and Automata Theory Unit 2

Practice objective questions for quick revision and examination preparation. Try answering each question before revealing the answer.

๐Ÿ“š Formal Languages and Automata Theory
๐Ÿ“– Unit 2
๐ŸŽฏ MCQs

Formal Languages and Automata Theory - Unit-2

1
Which regular expression represents all strings over {a, b} that end with 'b'?
Aa*b*
Bb(a+b)*
C(a+b)*b
D(a+b)*a
Correct Answer (a+b)*b
2
The language denoted by the regular expression โˆ…* is:
Aโˆ…
B{0}
Cฮฃ*
D{ฮต}
Correct Answer {ฮต}
3
Which of the following is NOT a basic operator of regular expressions?
AUnion
BComplementation
CKleene closure
DConcatenation
Correct Answer Complementation
4
Which of the following is an application of regular expressions?
AType checking
BGarbage collection
CLexical analysis in compilers
DMemory management
Correct Answer Lexical analysis in compilers
5
Regular expressions are widely used in which of the following?
ADisk scheduling
BPattern matching and text search
CSorting numbers
DProcess synchronization
Correct Answer Pattern matching and text search
6
The equivalence of regular expressions and finite automata is established by:
AArden's theorem
BPumping lemma
CKleene's theorem
DMyhill-Nerode theorem
Correct Answer Kleene's theorem
7
Which law is represented by r + s = s + r?
AAssociative law
BIdempotent law
CDistributive law
DCommutative law for union
Correct Answer Commutative law for union
8
Which law is represented by r + r = r?
AIdentity law
BIdempotent law
CDistributive law
DCommutative law
Correct Answer Idempotent law
9
Which law is represented by r(s + t) = rs + rt?
ACommutative law
BIdempotent law
CLeft distributive law
DAssociative law for concatenation
Correct Answer Left distributive law
10
For any regular expression r, ฮตr = rฮต = r. Hence ฮต is the ______ for concatenation.
AAnnihilator
BComplement
CInverse
DIdentity
Correct Answer Identity
11
For any regular expression r, โˆ…r = rโˆ… equals:
Aฮฃ*
Bโˆ…
Cฮต
Dr
Correct Answer โˆ…
12
(r*)* is equivalent to:
Aฮต
Br
Cr+
Dr*
Correct Answer r*
13
(ฮต + r)* is equivalent to:
Aโˆ…
Bฮต
Cr*
Dr+
Correct Answer r*
14
Which regular expression represents all strings over {0, 1} containing at least one 0?
A1*
B0*1*
C(0+1)*0(0+1)*
D(0+1)*1(0+1)*
Correct Answer (0+1)*0(0+1)*
15
The method used to convert a DFA into a regular expression is:
ASubset construction
BTable-filling algorithm
CThompson's construction
DState elimination method
Correct Answer State elimination method
16
Thompson's construction is used to convert:
AA regular expression into an ฮต-NFA
BA DFA into a regular expression
CAn NFA into a DFA
DA DFA into a minimal DFA
Correct Answer A regular expression into an ฮต-NFA
17
Arden's theorem states that if P does not contain ฮต, then the equation R = Q + RP has the unique solution:
AR = QP*
BR = P*Q
CR = PQ*
DR = Q*P
Correct Answer R = QP*
18
In Arden's theorem, the condition that P must not contain ฮต is required to ensure:
AThe language is empty
BThe solution is unique
CThe language is finite
DThe automaton is deterministic
Correct Answer The solution is unique
19
The pumping lemma for regular languages is used to prove that a language is:
ADecidable
BNot regular
CContext free
DRegular
Correct Answer Not regular
20
The pumping lemma is a ______ condition for a language to be regular.
ANeither necessary nor sufficient
BSufficient but not necessary
CBoth necessary and sufficient
DNecessary but not sufficient
Correct Answer Necessary but not sufficient
21
In the pumping lemma, a string w with |w| โ‰ฅ p is split as w = xyz. Which condition must hold?
A|xy| โ‰ค p
B|xz| โ‰ค p
C|y| = 0
D|yz| โ‰ค p
Correct Answer |xy| โ‰ค p
22
In the pumping lemma, the condition on the middle part y is:
A|y| = 0
B|y| > 0
C|y| < 0
D|y| = p
Correct Answer |y| > 0
23
According to the pumping lemma, for all i โ‰ฅ 0:
Axyzโฑ โˆˆ L
Bxyโฑz โˆ‰ L
Cxโฑyz โˆˆ L
Dxyโฑz โˆˆ L
Correct Answer xyโฑz โˆˆ L
24
In the pumping lemma, the constant p is called the:
ATransition count
BPumping length
CAlphabet size
DStack depth
Correct Answer Pumping length
25
Which of the following languages is NOT regular?
A(ab)*
B{aโฟbโฟ | n โ‰ฅ 0}
Ca*b*
DStrings over {a, b} with an even number of a's
Correct Answer {aโฟbโฟ | n โ‰ฅ 0}
26
Which of the following languages is NOT regular?
A{aโฟ | n โ‰ฅ 5}
B{aโฟ | n is even}
C{aโฟ | n mod 3 = 1}
D{aแต– | p is a prime number}
Correct Answer {aแต– | p is a prime number}
27
Regular languages are closed under:
AAll of the mentioned
BUnion
CComplementation
DIntersection
Correct Answer All of the mentioned
28
Which of the following is NOT a closure property of regular languages?
AClosure under infinite union
BClosure under union
CClosure under concatenation
DClosure under Kleene star
Correct Answer Closure under infinite union
29
To obtain a DFA for the complement of a regular language, we:
AAdd ฮต-transitions to every state
BReverse all transitions
CRemove the start state
DSwap accepting and non-accepting states of a complete DFA
Correct Answer Swap accepting and non-accepting states of a complete DFA
30
The automaton for the intersection of two regular languages is built using:
ASubset construction
BProduct construction
CState elimination
DThompson's construction
Correct Answer Product construction
31
The set difference L โˆ’ M of two regular languages L and M equals:
ALฬ„ โˆช M
BL โˆช Mฬ„
CLฬ„ โˆฉ M
DL โˆฉ Mฬ„
Correct Answer L โˆฉ Mฬ„
32
The reversal of a regular language is:
AAlways regular
BRegular only if finite
CNever regular
DContext sensitive only
Correct Answer Always regular
33
Regular languages are closed under homomorphism.
ATrue
BFalse
CTrue only for finite languages
DTrue only for unary alphabets
Correct Answer True
34
Which of the following problems is decidable for regular languages?
AEmptiness
BMembership
CAll of the mentioned
DFiniteness
Correct Answer All of the mentioned
35
A DFA accepts a non-empty language if and only if:
AThe start state is accepting
BThe DFA has no cycles
CAn accepting state is reachable from the start state
DAll states are accepting
Correct Answer An accepting state is reachable from the start state
36
A DFA accepts an infinite language if and only if:
AThe DFA has more than one accepting state
BThe start state has a self-loop
CA cycle lies on some path from the start state to an accepting state
DThe DFA has no cycles
Correct Answer A cycle lies on some path from the start state to an accepting state
37
The time taken to test whether a string of length n is accepted by a DFA is:
AO(n)
BO(nยฒ)
CO(log n)
DO(2โฟ)
Correct Answer O(n)
38
Which algorithm is used to test the equivalence of two DFAs and to minimize a DFA?
AArden's method
BPumping lemma
CThompson's construction
DTable-filling algorithm
Correct Answer Table-filling algorithm
39
Two states p and q of a DFA are distinguishable if there exists a string w such that:
AExactly one of ฮด(p,w) and ฮด(q,w) is an accepting state
BBoth ฮด(p,w) and ฮด(q,w) are accepting
CBoth ฮด(p,w) and ฮด(q,w) are non-accepting
Dฮด(p,w) = ฮด(q,w)
Correct Answer Exactly one of ฮด(p,w) and ฮด(q,w) is an accepting state
40
In the table-filling algorithm, the pairs initially marked as distinguishable are:
A(accepting state, non-accepting state)
B(non-accepting, non-accepting)
C(start state, start state)
D(accepting, accepting)
Correct Answer (accepting state, non-accepting state)
41
DFA minimization removes:
AUnreachable states and merges equivalent states
BAll non-accepting states
CAll accepting states
DAll transitions
Correct Answer Unreachable states and merges equivalent states
42
The Myhill-Nerode theorem states that a language L is regular if and only if:
AIt is accepted by a PDA
BIt satisfies the pumping lemma
CIt has a finite number of equivalence classes
DIt has an infinite number of equivalence classes
Correct Answer It has a finite number of equivalence classes
43
The minimal DFA for the language of all strings over {0, 1} ending with '01' has how many states?
A2
B3
C4
D5
Correct Answer 3
44
The minimal DFA of a regular language is:
AAlways has one state
BAlways an NFA
CUnique up to renaming of states
DNot unique
Correct Answer Unique up to renaming of states
โ† Back to All MCQs