Give step-by-step solution with explanation and final answer: Question 5 Show your work. Full marks will only be awarded if the workings are shown. ( a ) Write a regular expression for passwords with: At least one digit Only letters and digits No spaces or special characters. [ 3 marks ] ( b ) Describe a regular language where all strings contain " 1 0 1 " but never contain " 1 1 1 " . [ 2 marks ] ( c ) Prove using the Pumping Lemma that the language L = { a p | p i s a prime number } i s not regular. [ 2 marks ] ( d ) Provide an example of a string that belongs to the language generated by the context - free grammar G 1 , but not to the language generated by the context - free grammar G 2 , where G 1 and G 2 differ in their production rules for recursive structures. [ 3 marks ]Question 5 Show your work. Full marks will only be awarded if the workings are shown. (a) Write a regular expression for passwords with: + Atleast one digit « Only letters and digits + No spaces or special characters. [3 marks] (b) Describe a regular language where all strings contain “101” but never contain “111”. [2 marks] (c) Prove using the Pumping Lemma that the language L = {aP|pis a prime number} is not regular. [2 marks] (d) Provide an example of a string that belongs to the language generated by the context-free grammar G1, but not to the language generated by the context-free grammar G2, where G1 and G2 differ in their production rules for recursive structures. [3 marks]
Question:
Give step-by-step solution with explanation and final answer:
Question
5
Show your work. Full marks will only be awarded if the workings are shown.
(
a
)
Write a regular expression for passwords with:
At least one digit
Only letters and digits
No spaces or special characters.
[
3
marks
]
(
b
)
Describe a regular language where all strings contain
"
1
0
1
"
but never contain
"
1
1
1
"
.
[
2
marks
]
(
c
)
Prove using the Pumping Lemma that the language
L
=
{
a
p
|
p
i
s
a prime number
}
i
s
not regular.
[
2
marks
]
(
d
)
Provide an example of a string that belongs to the language generated by the context
-
free grammar G
1
,
but not to the language generated by the context
-
free grammar G
2
,
where G
1
and G
2
differ in their production rules for recursive structures.
[
3
marks
]
Question 5
Show your work. Full marks will only be awarded if the workings are shown.
(a) Write a regular expression for passwords with:
+ Atleast one digit
« Only letters and digits
+ No spaces or special characters.
[3 marks]
(b) Describe a regular language where all strings contain “101” but never contain “111”.
[2 marks]
(c) Prove using the Pumping Lemma that the language
L = {aP|pis a prime number} is not regular.
[2 marks]
(d) Provide an example of a string that belongs to the language generated by the
context-free grammar G1, but not to the language generated by the context-free
grammar G2, where G1 and G2 differ in their production rules for recursive
structures.
[3 marks]
Asked by: Alok Kumar
Created at: 2025-06-22 16:46:54
Final Answer:
📢 Instructions:
- Ask anything relatd to above question only.
- For new Question goto :
VIPSolutions