Unit 3: FORMAL LANGUAGES - Practice Quiz

CSE322 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What is the formal definition of a Grammar in Formal Language Theory?

A.
B.
C.
D.

2 In the grammar tuple , what does the intersection of and yield?

A. An empty set ()
B. The set of all production rules
C. The universal language
D. The start symbol

3 Which mathematical notation correctly denotes the language generated by a grammar ?

A.
B.
C.
D.

4 What is a 'derivation' in the context of formal grammars?

A. The process of converting an NFA to a DFA
B. A graph showing the states of an automaton
C. The complement of a regular language
D. A sequence of production rule applications replacing non-terminals to generate a string

5 In a leftmost derivation, which non-terminal is replaced at each step?

A. The leftmost non-terminal in the current sentential form
B. The rightmost non-terminal in the current sentential form
C. Any randomly chosen non-terminal
D. The start symbol only

6 What is a sentential form?

A. A production rule of the form
B. A string containing strictly terminal symbols
C. The final state of an accepting automaton
D. Any string in that can be derived from the start symbol

7 According to the Chomsky Hierarchy, Type 0 grammars generate which class of languages?

A. Context-Free Languages
B. Regular Languages
C. Recursively Enumerable Languages
D. Context-Sensitive Languages

8 Which type of grammar corresponds to Context-Free Languages in the Chomsky Hierarchy?

A. Type 2
B. Type 1
C. Type 0
D. Type 3

9 What is the proper subset relation defining the Chomsky hierarchy, where denotes Type languages?

A.
B.
C.
D.

10 What is the primary constraint on the production rules for a Type 1 (Context-Sensitive) grammar?

A.
B.
C. must be strictly empty
D. must be a single non-terminal

11 What is the only valid exception to the length-increasing rule () in a Context-Sensitive Grammar?

A. is allowed if is the last symbol of the string
B. Any non-terminal can derive once
C. is allowed provided does not appear on the right side of any production
D. There are absolutely no exceptions

12 What is the defining constraint on the production rules of a Type 2 (Context-Free) grammar?

A. The right-hand side must consist of exactly one terminal and one non-terminal
B. The left-hand side must consist of exactly one non-terminal
C. The left-hand side must contain at least one terminal
D. The length of the left side must be less than the right side

13 Which of the following describes the production rules for a Type 3 (Regular) grammar?

A. Rules can freely mix left-linear and right-linear forms in the same grammar
B. Rules must be strictly either right-linear or strictly left-linear
C. Rules must be of the form where
D. Rules must have exactly one non-terminal on the left and any string on the right

14 What is the only restriction on the production rules for a Type 0 (Unrestricted) grammar?

A. must contain at least one non-terminal
B. cannot be empty
C. must strictly contain only terminals
D. There are absolutely no restrictions on either or

15 Which computational model strictly corresponds to Recursively Enumerable (Type 0) languages?

A. Linear Bounded Automaton
B. Finite Automaton
C. Turing Machine
D. Pushdown Automaton

16 Which computational model strictly corresponds to Context-Sensitive (Type 1) languages?

A. Pushdown Automaton
B. Finite Automaton
C. Turing Machine
D. Linear Bounded Automaton

17 Which computational model strictly corresponds to Context-Free (Type 2) languages?

A. Pushdown Automaton
B. Finite Automaton
C. Turing Machine
D. Linear Bounded Automaton

18 Which computational model strictly corresponds to Regular (Type 3) languages?

A. Turing Machine
B. Linear Bounded Automaton
C. Pushdown Automaton
D. Finite Automaton

19 By definition, a language is called 'Recursive' if:

A. There exists a Turing Machine that accepts strings in but may loop forever on strings not in .
B. It requires infinite time to compute.
C. There exists a Turing Machine that halts on every input string, accepting if it is in and rejecting if it is not.
D. It can be recognized by a Finite Automaton.

20 By definition, a language is called 'Recursively Enumerable' (RE) if:

A. There exists a Turing Machine that always halts on all inputs.
B. It has a finite number of strings.
C. There exists a Turing Machine that halts and accepts if a string is in , but may loop indefinitely if the string is not in .
D. It can be parsed using a regular expression.

21 Which of the following is true regarding the complement of a Recursive language?

A. It is Recursively Enumerable but not Recursive.
B. It is never Recursive.
C. It is always a Context-Free Language.
D. It is always Recursive.

22 What can be said about the complement of a Recursively Enumerable (RE) language that is NOT Recursive?

A. It is always Recursive.
B. It is Regular.
C. It is strictly Context-Free.
D. It is not Recursively Enumerable.

23 What does Post's Theorem state regarding formal languages?

A. The intersection of two Context-Free languages is always Context-Free.
B. If a language and its complement are both Recursively Enumerable, then is Recursive.
C. Every Regular language is Context-Free.
D. If a language is Context-Free, it must be Recursive.

24 How is the Halting Problem classified in formal language theory?

A. It is not even Recursively Enumerable.
B. It is a Regular Language.
C. It is Recursively Enumerable but not Recursive.
D. It is Recursive.

25 The intersection of a Context-Free Language (CFL) and a Regular Language is always:

A. Regular
B. Recursively Enumerable only
C. Context-Free
D. Context-Sensitive but not Context-Free

26 Are Context-Free Languages (CFLs) closed under intersection?

A. No, the intersection is always Regular.
B. Yes, but only if they are ambiguous.
C. Yes, the intersection of two CFLs is always a CFL.
D. No, the intersection of two CFLs is not necessarily a CFL.

27 Which of the following describes the generic form of production rules in a Right-Linear Grammar?

A. or (where is a terminal string)
B. or (where is a terminal string)
C.
D. only

28 Which of the following describes the generic form of production rules in a Left-Linear Grammar?

A. only
B. or (where is a terminal string)
C. or (where is a terminal string)
D.

29 If a grammar freely mixes left-linear rules (e.g., ) and right-linear rules (e.g., ), what type of grammar is it?

A. Regular Grammar
B. Unrestricted Grammar strictly
C. Linear Grammar
D. Context-Sensitive Grammar strictly

30 Every valid Regular Grammar (either strictly right-linear or strictly left-linear) generates:

A. An undecidable language
B. A Context-Sensitive Language that is not Regular
C. A Regular Set (Regular Language)
D. A strictly Finite Set

31 Which operation are Regular Languages NOT necessarily closed under?

A. Complement
B. Intersection
C. Infinite Union
D. Finite Union

32 Which right-linear regular grammar correctly generates the regular expression ?

A.
B.
C.
D.

33 Which right-linear regular grammar correctly generates the regular expression ?

A.
B.
C.
D.

34 Which right-linear regular grammar correctly generates the regular expression ?

A.
B.
C.
D.

35 Arden's Theorem is primarily utilized for which of the following purposes in Formal Language Theory?

A. Converting a Context-Free Grammar to Chomsky Normal Form
B. Minimizing the number of states in a DFA
C. Converting a DFA or Regular Grammar into a Regular Expression
D. Proving that a language is not regular using the Pumping Lemma

36 Arden's Theorem states that for sets , and , the equation has a unique solution provided what condition is met?

A. and are disjoint sets
B. does not contain the empty string
C. does not contain the empty string
D. is a finite language

37 Under Arden's Theorem, if and does not contain , what is the unique solution for ?

A.
B.
C.
D.

38 For the language equation (which arises from right-linear grammars), if does not contain , what is the unique solution for ?

A.
B.
C.
D.

39 Convert the right-linear grammar into an equivalent Regular Expression.

A.
B.
C.
D.

40 Convert the left-linear grammar into an equivalent Regular Expression.

A.
B.
C.
D.

41 Find the regular expression for the right-linear grammar: , .

A.
B.
C.
D.

42 Find the regular expression for the grammar: , .

A.
B.
C.
D.

43 Is every Context-Free Language also a Regular Language?

A. Yes, every Context-Free Language is Regular.
B. No, Context-Free Languages are a strict subset of Regular Languages.
C. No, Regular Languages are a strict subset of Context-Free Languages.
D. Yes, but only if it contains the empty string.

44 Every Context-Free Language is also a:

A. Linear Language
B. Regular Language
C. Finite Language
D. Context-Sensitive Language

45 Which of the following languages is strictly Context-Free but NOT Regular?

A.
B.
C.
D.

46 Which of the following languages is Context-Sensitive but NOT Context-Free?

A.
B.
C.
D.

47 Two formal languages and are said to be equivalent if and only if:

A. They share at least one common string
B. They belong to the same Chomsky Hierarchy class
C. They contain exactly the same set of strings ()
D. They are generated by the exact same grammar rules

48 Which of the following statements about the union of Recursive and Recursively Enumerable languages is TRUE?

A. The union of two Recursive languages is always Recursive.
B. The union of two RE languages is never RE.
C. The union of a Recursive language and a Regular language is Context-Free.
D. The union of two Recursive languages is Recursively Enumerable but not Recursive.

49 What kind of grammar allows rules where the left-hand side can be any string containing at least one non-terminal, and the right-hand side can be shorter than the left-hand side?

A. Type 2 (Context-Free Grammar)
B. Type 1 (Context-Sensitive Grammar)
C. Type 3 (Regular Grammar)
D. Type 0 (Unrestricted Grammar)

50 Which automaton corresponds to a language formed by freely mixing left-linear and right-linear grammar rules (A Linear Grammar)?

A. Linear Bounded Automaton only
B. Finite Automaton
C. Turing Machine only
D. Pushdown Automaton (specifically one-turn PDA)