Consider the following languages:
Note that is the reversal of the string Which of the following is/are
View worked solution
Answer: A;B;C
To determine the nature of the languages and , we analyze them individually:
Analysis of :
- If , choosing gives , which is regular.
- If , any string in must start with and end with . By choosing , we can write any such string as for some . Thus, , which is regular.
In either standard interpretation of , is a regular language.
Analysis of :
- Since , the simplest choice for is a single character, i.e., or .
- If , then , giving strings of the form where .
- If , then , giving strings of the form where .
Any string of length that starts and ends with the same character belongs to . Thus, we can express as the regular expression: Hence, is also a regular language.
Since every regular language is also a context-free language (CFL):
- A is TRUE: Both and are regular.
- B is TRUE: Both and are context-free.
- C is TRUE: is regular and is context-free (since is regular, it is also context-free).
- D is FALSE: They are regular.
Free practice · Your answers on this page are not saved.
