Unit 2 MCQ
Unit 2 MCQ
- A) `a* + b`
- B) `*a`
- C) `++`
- D) `a?b?c?`
- **Answer:** A
- **Answer:** B
- A) `+`
- B) `*`
- C) `?`
- D) `^`
- **Answer:** B
- B) `{0, 1}*`
- C) `{a, b}*`
- D) `∅`
- **Answer:** A
- A) `R`
- B) `R*`
- C) `2R`
- D) `∅`
- **Answer:** A
7. **Which theorem states that if `P` does not contain `Λ`, then `R = Q + RP` has a unique
solution?**
- A) Pumping Lemma
- B) Arden’s Theorem
- C) Myhill-Nerode Theorem
- D) Kleene’s Theorem
- **Answer:** B
- **Answer:** A
9. **Which operation is NOT closed for regular languages?**
- A) Union
- B) Intersection
- C) Complement
- **Answer:** D
- A) Strings that start with `a` and can be followed by `a` or `b`
- **Answer:** A
- **Answer:** A
12. **In the pumping lemma, `w = xyz`, what does `y` represent?**
- C) A prefix of `w`
- **Answer:** B
- **Answer:** D
- **Answer:** A
- **Answer:** B
- **Answer:** B
- C) A non-final state
- **Answer:** A
18. **What does `Q` represent in the context of finite automata?**
- **Answer:** B
19. **Which of the following regular expressions matches the string `abba`?**
- A) `ab*`
- B) `(ab)*`
- C) `a(b|a)b`
- D) `ab+`
- **Answer:** C
20. **Which of the following represents the empty set in regular expressions?**
- A) `Λ`
- B) `∅`
- C) `*`
- **Answer:** B
21. **What is the language accepted by the DFA that starts with `0` and ends with `1`?**
- A) `0(0 + 1)*1`
- B) `0*1*`
- C) `1*0*1`
- D) `0(0 + 1)*`
- **Answer:** A
- A) Always regular
- B) Always context-free
- C) Sometimes regular
- D) Never regular
- **Answer:** A
- A) Pushdown automata
- B) Turing machines
- C) DFAs
- **Answer:** C
24. **What is the effect of removing ε-transitions from a nondeterministic finite automaton
(NFA)?**
- **Answer:** C
- A) `b*`
- B) `Λ`
- C) All strings over the alphabet `{a, b}` that are not made up solely of `a`
- **Answer:** C
26. **Which regular expression represents the language consisting of strings with an even
number of `a`s?**
- A) `(aa)*`
- B) `(a(aa)*)*`
- C) `a*(aa)*`
- D) `a(a(a|b)*a)*`
- **Answer:** A
- C) Closure of `R1`
- **Answer:** B
- **Answer:** A
- C) For each state and input symbol, there is exactly one transition
- **Answer:** C
- **Answer:** A
31. **
Which regular expression matches any string over the alphabet `{0, 1}`?**
- A) `0*1*`
- B) `(0 + 1)*`
- C) `0?1?`
- **Answer:** B
- **Answer:** B
- **Answer:** C
- **Answer:** B
- C) Both A and B
- **Answer:** C
36. **What is the minimal DFA for the regular expression `a*`?**
- **Answer:** A
37. **In the context of regular expressions, what does `|` denote?**
- A) Closure
- B) Concatenation
- C) Union
- **Answer:** C
- A) Strings with at most one `a`, one `b`, and one `c`
- **Answer:** A
- A) δ
- B) L
- C) Q
- D) F
- **Answer:** A
40. **Which of the following can be used to show that a language is not regular?**
- A) Pumping Lemma
- B) Closure properties
- **Answer:** A
- **Answer:** B
42. **Which of the following expressions represents strings that contain at least one `0`?**
- A) `1*0*`
- B) `0 + 1*`
- C) `1*0+`
- D) `1*0+1*`
- **Answer:** D
- **Answer:** A
44. **What type of automaton recognizes context-free languages?**
- A) Finite Automaton
- B) Pushdown Automaton
- C) Turing Machine
- **Answer:** B
- **Answer:** B
- A) Palindromes
- B) Anbn
- **Answer:** C
- **Answer:** B
48. **What is the result of the concatenation of two regular expressions `R1` and `R2`?**
- A) `R1 + R2`
- B) `R1R2`
- C) `R1*`
- **Answer:** B
- **Answer:** A
- **Answer:** B
51. **What is the language recognized by a DFA that accepts strings that do not contain the
substring `00`?**
- A) `1*`
- B) `(1 + 01)*`
- C) `1*(01)*`
- **Answer:** C
52. **Which of the following regular expressions matches strings with an odd number of
`1`s?**
- A) `(0*10*1)*`
- B) `(0 + 1)*`
- C) `0*1(0*10*1)*`
53. **In a DFA, if a state has no outgoing transitions for an input symbol, what happens?**
- **Answer:** B
- A) Finite Automaton
- B) Pushdown Automaton
- C) Turing Machine
- D) Both A and C
- **Answer:** D
- A) `(a | b)*`
- B) `++`
- C) `a*?`
- **Answer:** A
- **Answer:** A
57. **The regular expression `a?b?` can generate which of the following strings?**
- A) `ab`
- B) `a`
- C) `b`
- **Answer:** D
58. **Which of the following represents the set of strings of even length?**
- B) `(aa + bb)*`
- C) `(00 + 11)*`
- **Answer:** D
59. **If `L1` and `L2` are regular languages, what can we say about `L1 ∩ L2`?**
- A) It is always regular
- B) It is not regular
- C) It is sometimes regular
- **Answer:** A
- B) Context-free languages
- C) Context-sensitive languages
- D) Both A and B
- **Answer:** B
61. **What is the expression for the complement of the language represented by `ab*`?**
- A) `a?b?`
- B) `
b*`
- C) `0*`
- **Answer:** D
- A) Finite sets
- B) Infinite sets
- C) Context-free languages
- D) Regular languages
- **Answer:** C
- **Answer:** A
- C) Union of strings
- **Answer:** A
65. **Which of the following regular expressions will match the string `aa`?**
- A) `a+`
- B) `aa*`
- C) `a?`
- D) `a*`
- **Answer:** D
- **Answer:** A
- A) Strings that start with `a` and can have any combination of `a` and `b`
- **Answer:** A
- **Answer:** A
- C) Only `a`
- **Answer:** A
70. **What is the regular expression for binary strings ending with `01`?**
- A) `(0 + 1)*01`
- B) `0*1*01`
- **Answer:** A
- A) Union
- B) Intersection
- C) Concatenation
- **Answer:** D
72. **What is the relationship between regular expressions and finite automata?**
- C) Both A and B
- **Answer:** C
- **Answer:** A
- **Answer:** C
75. **The set of strings accepted by the regular expression `(01)*` is:**
- **Answer:** C
- **Answer:** B
- **Answer:** B
78. **What is the language recognized by a DFA that accepts strings containing an odd number
of `0`s?**
- A) `0*`
- B) `1*(01*0)*`
- C) `1*(0 + 1)*`
- D) `0*1*`
- **Answer:** B
79. **What does the regular expression `(a + b)?` represent?**
- **Answer:** B
- **Answer:** B
- A) Union
- B) Intersection
- C) Complement
- **Answer:** D
82. **Which of the following regular expressions matches the empty string?**
- A) `a?`
- B) `a*`
- C) `ab*`
- D) Both A and B
- **Answer:** D
- **Answer:** C
- **Answer:** A
85. **Which of the following strings can be generated by the regular expression `0(0 + 1)*1`?**
- A) `00`
- B) `01`
- C) `11`
- **Answer:** D
- **Answer:** A
87. **What is the regular expression for binary strings with an even number of `1`s?**
- A) `(0 + 1)*`
- B) `(00 + 11 + 01 + 10)*`
- C) `(00 + 11)*`
88. **Which regular expression denotes strings that contain at least one `a` and at least one
`b`?**
- A) `a*b*`
- B) `a+b+`
- C) `(a + b)*`
- D) `a+b*`
- **Answer:** C
- A) The set of strings that can be formed by concatenating `R` any number of times, including
zero
- **Answer:** A
- **Answer:** B
- A) An automaton that can have multiple transitions for the same input
- C) An automaton where each state has exactly one transition for each input symbol
- A) Regular language
- B) Context-free language
- C) Context-sensitive language
- **Answer:** B
- **Answer:** A
- **Answer:** A
- C) An empty language
- **Answer:** B
96. **What is the relationship between regular languages and context-free languages?**
- A) All regular languages are context-free
- C) Both A and B
- **Answer:** A
- **Answer:** A
- **Answer:** B
99. **Which of the following regular expressions matches strings with at least one `a` and at
least one `b`?**
- A) `a*b*`
- B) `a+b+`
- C) `a+b?`
- **Answer:** B
- B) A grammar where the left-hand side of every production rule has exactly one non-terminal
symbol
- **Answer:** B
---
Feel free to ask any specific questions about the material or let me know if you need more
explanations!