Grand Assignment
Total Questions: 31
Before mid-questions are optional.
Section A: Regular Languages and Finite Automata
1. Construct a DFA to accept strings over {a, b} that contain at least two a’s and end with b.
2. Prove or disprove: The language L = {w | w has equal number of a’s and b’s} is regular.
3. Write a regular expression for strings over {0,1} that start and end with 1.
4. Use the pumping lemma to prove that L = {aⁿbⁿ | n ≥ 1} is not regular.
5. State and explain closure properties of regular languages with examples.
6. Describe the process of minimizing a DFA with an example.
Section B: Mealy & Moore Machines
7. Design a Mealy machine that outputs 1 every time the input string has two consecutive
0s.
8. Construct a Moore machine to output 1 if the last two input bits were equal, else 0.
9. Explain with an example how Mealy and Moore machines differ in their output behavior.
10. Given a Mealy machine, trace the input string 101100 and record the outputs.
Section C: Context-Free Grammars and Derivations
11. Construct a CFG for the language L = {aⁿbⁿ | n ≥ 0}.
12. Give derivation and parse tree for the string “aaabbb” using your CFG from Q11.
13. Design a CFG for L = {wcwᵣ | w ∈ (a,b)*}, and derive “abbcbba”.
14. Convert the following BNF to EBNF:
<number> ::= <digit> {<digit>}
<digit> ::= 0 | 1 | ... | 9
15. Convert the following EBNF to BNF:
<exp> ::= <term> { (+|-) <term> }
16. Check if the string abb can be derived from S → aSb | ab.
17. Write a CFG for the palindrome language over {a, b}.
18. Construct a CFG for L = {aⁿb²ⁿ | n ≥ 1}, and derive the string aaabbbbbb.
Section D: Pushdown Automata (PDA)
19. Construct a PDA for the language L = {aⁿbⁿ | n ≥ 1}.
20. Design a PDA for L = {a²ⁿbⁿ | n ≥ 1}.
21. Trace the PDA for L = {aⁿbⁿ} on input aaabbb. Show stack status.
22. Convert the CFG S → aSb | ε into a PDA.
23. Explain why L = {aⁿbⁿcⁿ | n ≥ 1} is not context-free using Pumping Lemma.
24. Construct a PDA for the language L = {w ∈ {a, b} | w is a palindrome}.
Section E: Turing Machines (TM)
25. Design a TM that accepts the language L = {aⁿbⁿcⁿ | n ≥ 1}.
26. Design a TM to accept binary strings that are palindromes.
27. Create a TM that doubles the string (e.g., input ab becomes abab).
28. Design a TM that increments a binary number on the tape.
29. Design a TM that computes the sum of two unary numbers separated by #.
30. Describe the working of a TM for string aaabbb under a given transition diagram.
31. Write transitions of a TM that detects if input contains substring ab.