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. The universal language
B. The set of all production rules
C. An empty set ()
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 complement of a regular language
B. A sequence of production rule applications replacing non-terminals to generate a string
C. The process of converting an NFA to a DFA
D. A graph showing the states of an automaton

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

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

6 What is a sentential form?

A. A production rule of the form
B. The final state of an accepting automaton
C. A string containing strictly terminal symbols
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-Sensitive Languages
B. Context-Free Languages
C. Recursively Enumerable Languages
D. Regular Languages

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

A. Type 0
B. Type 1
C. Type 2
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. must be strictly empty
B. must be a single non-terminal
C.
D.

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 length of the left side must be less than the right side
B. The right-hand side must consist of exactly one terminal and one non-terminal
C. The left-hand side must contain at least one terminal
D. The left-hand side must consist of exactly one non-terminal

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

A. There exists a Turing Machine that halts and accepts if a string is in , but may loop indefinitely if the string is not in .
B. There exists a Turing Machine that always halts on all inputs.
C. It has a finite number of strings.
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 always Recursive.
B. It is always a Context-Free Language.
C. It is never Recursive.
D. It is Recursively Enumerable but not Recursive.

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

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

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

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

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

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

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

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

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

A. Yes, the intersection of two CFLs is always a CFL.
B. No, the intersection is always Regular.
C. Yes, but only if they are ambiguous.
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. only
C.
D. or (where is a terminal string)

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. Unrestricted Grammar strictly
B. Regular Grammar
C. Linear Grammar
D. Context-Sensitive Grammar strictly

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

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

31 Which operation are Regular Languages NOT necessarily closed under?

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

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. Converting a DFA or Regular Grammar into a Regular Expression
C. Minimizing the number of states in a DFA
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. is a finite language
B. does not contain the empty string
C. and are disjoint sets
D. does not contain the empty string

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. Yes, but only if it contains the empty string.
D. No, Regular Languages are a strict subset of Context-Free Languages.

44 Every Context-Free Language is also a:

A. Context-Sensitive Language
B. Linear Language
C. Regular Language
D. Finite 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 contain exactly the same set of strings ()
B. They are generated by the exact same grammar rules
C. They belong to the same Chomsky Hierarchy class
D. They share at least one common string

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

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

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 1 (Context-Sensitive Grammar)
B. Type 0 (Unrestricted Grammar)
C. Type 2 (Context-Free Grammar)
D. Type 3 (Regular Grammar)

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

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