NPTEL Theory of Computation Week 4 Assignment Answers 2024

Sanket
By Sanket

NPTEL Theory of Computation Week 4 Assignment Answers 2024

1. Consider the following context-free grammar:

                            S→S0S1∣S1S0∣ϵ

Which of the following is the language generated by this grammar?

  • Set of all palindromes
  • Set of all even numbers
  • Set of all strings having either only 0’s or only 1’s
  • Set of all strings having equal number of 0’s and 1’s
Answer :- For Answers Click Hera 

2. Consider the following grammar

                     S⟶PQ∣ϵ

                     P⟶PP∣ϵ

                     Q⟶QQ∣ϵ

Which of the following regular expressions generates the same language as the given grammar?

  • 01
  • 0+1
  • (0+1)
  • 0011
Answer :- For Answers Click Hera 

3. Consider the following grammar

                            S⟶0AB∣1BA∣ϵ

                            A⟶0A0∣1A1∣ϵ

                            B⟶0B1∣1B0∣ϵ

Which of the following strings does not belong to the language generated by this grammar?

  • 0011010
  • 0101001
  • 1101000
  • 1011001
Answer :- 

4. Consider the following DFA.

image9
image 88
Answer :- 

5. Choose the CFG that generates the same language generated by the regular expression (bab).

  • S⟶babS∣ϵ
  • S⟶bS∣aS∣ϵ
  • S⟶babS∣bab
  • S⟶baS∣abS∣ϵ
Answer :- 

6. Which of the following context-free grammars is ambiguous?

  • S⟶0S1∣ϵ
  • S⟶0S1∣0∣1∣ϵ
  • S⟶0S0∣1S1∣0∣1∣ϵ
  • S⟶S0∣0∣1∣ϵ
Answer :- For Answers Click Hera 

7. Let D be a DFA with n states that accepts the language L. Let G be the context-free grammar having the least number of non-terminals that generates L. The number of non-terminals in G is at most (select the smallest possible value)

  • n
  • 2n
  • n2
  • 2n
Answer :- 

8. Which of the following is the context free grammar that generates the set of all palindromes over the alphabet {0,1}?

  • S⟶0S0∣1S1∣0∣1
  • S⟶0S0∣1S1∣0∣1∣ϵ
  • S⟶0S0∣1S1∣ϵ
  • S⟶0S1∣1S0∣ϵ
Answer :- For Answers Click Hera 
Share This Article
Leave a comment