0% found this document useful (0 votes)
24 views28 pages

Automata PDF

Uploaded by

Ansh Chaurasiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views28 pages

Automata PDF

Uploaded by

Ansh Chaurasiya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Unit 1

What is a Finite Automaton?


A) A computer with infinite memory
B) A mathematical model of computation with limited memory
C) A Turing machine
D) A quantum computer
Answer: B

Which of the following is NOT a type of Finite State Machine?


A) Deterministic Finite State Machine (DFA)
B) Non-Deterministic Finite State Machine (NDFA)
C) Mealy Machine
D) Context-Free Grammar
Answer: D

In a Deterministic Finite State Machine (DFA), for each input symbol, there is exactly:
A) One possible next state
B) Two possible next states
C) Three possible next states
D) No next state
Answer: A

What is a Transition System in the context of Finite Automata?


A) A set of states and a set of transitions between them
B) The alphabet used in the automaton
C) The input string to the automaton
D) The output of the automaton
Answer: A

Which property of a Transition Function describes the behavior of a Finite Automaton?


A) Injectivity
B) Surjectivity
C) Determinism
D) Boundedness
Answer: C

A string is accepted by a Finite Automaton if:


A) It reaches the initial state
B) It reaches an accepting state when processed
C) It has a loop
D) It is empty
Answer: B

The equivalence between a Deterministic Finite Automaton (DFA) and a Non-Deterministic Finite Automat
on (NDFA) is related to which concept?
A) P vs. NP
B) Turing completeness
C) Pumping Lemma
D) Regular languages
Answer: D

Mealy and Moore machines are types of:


A) Turing machines
B) Finite Automata
C) Pushdown Automata
D) Context-Free Grammars
Answer: B

What distinguishes a Mealy machine from a Moore machine?


A) Mealy machines have no output, while Moore machines have output with each transition.
B) Moore machines have no output, while Mealy machines have output with each transition.
C) Mealy machines have more states than Moore machines.
D) Moore machines can process context-free languages.
Answer: A

What is the primary purpose of minimizing a Finite Automaton?


A) Reducing the number of states while preserving functionality
B) Increasing the number of states for better performance
C) Adding more transitions to the automaton
D) Eliminating all accepting states
Answer: A

Which of the following is NOT part of the basics of Finite Automata?


A) States
B) Transitions
C) Output symbols
D) Alphabet
Answer: C

What is the purpose of a Transition Graph in Finite Automata?


A) To represent the input alphabet
B) To visualize the states and transitions
C) To represent the output of the automaton
D) To list all accepting states
Answer: B

Regular languages are a subset of which class of languages in formal language theory?
A) Context-Free Languages
B) Context-Sensitive Languages
C) Recursive Languages
D) Chomsky Languages
Answer: A

Which of the following statements is true about Regular Languages?


A) They can be recognized by any Turing machine.
B) They can be recognized by a Finite Automaton.
C) They always contain context-sensitive patterns.
D) They are equivalent to context-free languages.
Answer: B

The equivalence between Deterministic and Non-Deterministic Finite Automata (DFA and NDFA) is based
on:
A) The Church-Turing thesis
B) The pumping lemma
C) The Myhill-Nerode theorem
D) The Halting problem
Answer: C

In a DFA, if there is no transition defined for an input symbol, the automaton:


A) Halts
B) Moves to the initial state
C) Rejects the input string
D) Accepts the input string
Answer: C

Which of the following is an example of a Non-Deterministic Finite Automaton (NDFA)?


A) A vending machine
B) A calculator
C) A maze-solving robot
D) A traffic light controller
Answer: C

In a Mealy machine, output depends on the current state and:


A) The input symbol
B) The next state
C) The initial state
D) The alphabet
Answer: A

In a Moore machine, output depends only on:


A) The current state
B) The input symbol
C) The next state
D) The initial state
Answer: A

The process of minimizing a Finite Automaton aims to:


A) Maximize the number of states for better recognition
B) Reduce the number of transitions
C) Increase the alphabet size
D) Eliminate all transitions
Answer: B

A Finite Automaton recognizes a language if:


A) It can generate any string in the language.
B) It can accept any string in the language.
C) It can process any string in the language.
D) It can parse any string in the language.
Answer: B

What is the primary difference between Mealy and Moore machines?


A) Mealy machines have no states.
B) Mealy machines have no output.
C) Mealy machines have no transitions.
D) Mealy machines have output with transitions.
Answer: D

The equivalence between DFA and NDFA is related to which concept in formal language theory?
A) Pumping Lemma
B) Context-Free Grammars
C) Regular Expressions
D) Myhill-Nerode Theorem
Answer: D

Which of the following languages can be recognized by a Finite Automaton?


A) Context-Free Languages
B) Context-Sensitive Languages
C) Regular Languages
D) Chomsky Languages
Answer: C

What is the primary purpose of transition functions in a Finite Automaton?


A) To determine the initial state
B) To define the output symbols
C) To specify the next state based on input symbols
D) To determine the alphabet
Answer: C

A Finite Automaton can be represented as a directed graph where:


A) Nodes represent transitions and edges represent states.
B) Nodes represent states and edges represent transitions.
C) Both nodes and edges represent states.
D) Both nodes and edges represent transitions.
Answer: B

Which of the following is NOT a property of transition functions in Finite Automata?


A) Surjectivity
B) Determinism
C) Injectivity
D) Boundedness
Answer: D

Which of the following is a property of Regular Languages?


A) They are Turing-complete.
B) They can be recognized by a context-free grammar.
C) They can be recognized by a pushdown automaton.
D) They can be recognized by a Finite Automaton.
Answer: D

In a DFA, what happens when there is no defined transition for an input symbol?
A) The automaton halts.
B) The automaton moves to the initial state.
C) The automaton rejects the input.
D) The automaton accepts the input.
Answer: C

What is the primary purpose of the alphabet in Finite Automata?


A) To define the output symbols
B) To specify the initial state
C) To determine the set of input symbols
D) To determine the set of states
Answer: C

A Transition System in Finite Automata consists of:


A) The alphabet and output symbols.
B) The set of states and the set of transitions.
C) The set of accepting states and the set of rejecting states.
D) The set of initial states and the set of final states.
Answer: B
What is the primary function of the Transition Graph in Finite Automata?
A) To represent the output symbols.
B) To visualize the states and transitions.
C) To list all accepting states.
D) To specify the alphabet.
Answer: B

Which of the following statements is true about Regular Languages?


A) They can be recognized by any Turing machine.
B) They can be recognized by a Finite Automaton.
C) They always contain context-sensitive patterns.
D) They are equivalent to context-free languages.
Answer: B

The equivalence between Deterministic and Non-Deterministic Finite Automata (DFA and NDFA) is based
on:
A) The Church-Turing thesis.
B) The pumping lemma.
C) The Myhill-Nerode theorem.
D) The Halting problem.
Answer: C

In a DFA, if there is no transition defined for an input symbol, the automaton:


A) Halts.
B) Moves to the initial state.
C) Rejects the input string.
D) Accepts the input string.
Answer: C

Which of the following is an example of a Non-Deterministic Finite Automaton (NDFA)?


A) A vending machine.
B) A calculator.
C) A maze-solving robot.
D) A traffic light controller.
Answer: C

In a Mealy machine, output depends on the current state and:


A) The input symbol.
B) The next state.
C) The initial state.
D) The alphabet.
Answer: A

In a Moore machine, output depends only on:


A) The current state.
B) The input symbol.
C) The next state.
D) The initial state.
Answer: A

The process of minimizing a Finite Automaton aims to:


A) Maximize the number of states for better recognition.
B) Reduce the number of transitions.
C) Increase the alphabet size.
D) Eliminate all transitions.
Answer: B

A Finite Automaton recognizes a language if:


A) It can generate any string in the language.
B) It can accept any string in the language.
C) It can process any string in the language.
D) It can parse any string in the language.
Answer: B

What is the primary difference between Mealy and Moore machines?


A) Mealy machines have no states.
B) Mealy machines have no output.
C) Mealy machines have no transitions.
D) Mealy machines have output with transitions.
Answer: D

The equivalence between DFA and NDFA is related to which concept in formal language theory?
A) Pumping Lemma.
B) Context-Free Grammars.
C) Regular Expressions.
D) Myhill-Nerode Theorem.
Answer: D

Which of the following languages can be recognized by a Finite Automaton?


A) Context-Free Languages.
B) Context-Sensitive Languages.
C) Regular Languages.
D) Chomsky Languages.
Answer: C

What is the primary purpose of transition functions in a Finite Automaton?


A) To determine the initial state.
B) To define the output symbols.
C) To specify the next state based on input symbols.
D) To determine the alphabet.
Answer: C

A Finite Automaton can be represented as a directed graph where:


A) Nodes represent transitions and edges represent states.
B) Nodes represent states and edges represent transitions.
C) Both nodes and edges represent states.
D) Both nodes and edges represent transitions.
Answer: B

Which of the following is NOT a property of transition functions in Finite Automata?


A) Surjectivity.
B) Determinism.
C) Injectivity.
D) Boundedness.
Answer: D

Which of the following is a property of Regular Languages?


A) They are Turing-complete.
B) They can be recognized by a context-free grammar.
C) They can be recognized by a pushdown automaton.
D) They can be recognized by a Finite Automaton.
Answer: D

In a DFA, what happens when there is no defined transition for an input symbol?
A) The automaton halts.
B) The automaton moves to the initial state.
C) The automaton rejects the input.
D) The automaton accepts the input.
Answer: C

What is the primary purpose of the alphabet in Finite Automata?


A) To define the output symbols.
B) To specify the initial state.
C) To determine the set of input symbols.
D) To determine the set of states.
Answer: C

A Transition System in Finite Automata consists of:


A) The alphabet and output symbols.
B) The set of states and the set of transitions.
C) The set of accepting states and the set of rejecting states.
D) The set of initial states and the set of final states.
Answer: B

Numerical
How many states are there in a DFA that recognizes the language L = {0, 1} where the number of 0s is di
visible by 3?
A) 2
B) 3
C) 4
D) 5
Answer: B

If a DFA has 5 states, and the alphabet contains 4 symbols, how many transitions are there in the DFA?
A) 10
B) 15
C) 20
D) 25
Answer: C

Calculate the number of states in the minimized DFA for the regular expression (0 + 1)*.
A) 1
B) 2
C) 3
D) 4
Answer: B

If an NDFA has 3 states and 2 possible transitions for each input symbol, how many possible transition co
nfigurations are there?
A) 4
B) 6
C) 8
D) 12
Answer: A
Given an alphabet Σ = {a, b, c}, how many strings of length 4 can be generated from Σ?
A) 27
B) 64
C) 81
D) 256
Answer: C

Calculate the number of states required in a DFA to recognize the language L = {0^n1^n | n ≥ 1}.
A) 2
B) 3
C) 4
D) 5
Answer: B

If a Moore machine has 4 states and each state can produce 2 different outputs, how many distinct output
sequences can it generate for a given input sequence?
A) 8
B) 16
C) 32
D) 64
Answer: B

Determine the number of possible strings in the regular language L = {ab, ba, aab, bba}.
A) 2
B) 3
C) 4
D) 5
Answer: C

How many states are there in the minimized DFA for the regular expression (01 + 10)*?
A) 1
B) 2
C) 3
D) 4
Answer: B

Given an alphabet Σ = {x, y, z}, how many different strings of length 3 can be formed?
A) 6
B) 9
C) 27
D) 81
Answer: C

Calculate the number of strings of length 5 that can be generated from the alphabet {0, 1, 2}.
A) 15
B) 81
C) 125
D) 243
Answer: D

In a Mealy machine, if there are 4 states and each state can produce 3 different outputs, how many distin
ct output sequences can it generate for a given input sequence of length 3?
A) 9
B) 12
C) 27
D) 81
Answer: D

How many transitions are there in a DFA that recognizes the language L = {0, 1, 2}?
A) 6
B) 9
C) 12
D) 15
Answer: D

Determine the number of possible strings in the language L = {aa, bb, ab, ba}.
A) 2
B) 3
C) 4
D) 5
Answer: C

Calculate the total number of states in a DFA that recognizes the language L = {w | w is a binary string wit
h an even number of 1s}.
A) 1
B) 2
C) 3
D) 4
Answer: B

If an NDFA has 3 states and 3 possible transitions for each input symbol, how many possible transition co
nfigurations are there?
A) 9
B) 18
C) 27
D) 81
Answer: C

Determine the number of strings in the regular language L = {abc, def, ghi}.
A) 2
B) 3
C) 4
D) 6
Answer: B

How many states are there in the minimized DFA for the regular expression (00 + 11)*?
A) 1
B) 2
C) 3
D) 4
Answer: B

Given an alphabet Σ = {A, B, C}, how many different strings of length 4 can be formed?
A) 12
B) 27
C) 64
D) 81
Answer: D
Calculate the number of strings in the language L = {a^n | n is a prime number}.
A) Infinite
B) 1
C) 2
D) 3
Answer: A

Unit 2

What is the purpose of regular expressions in computer science?


A) To define context-free grammars
B) To describe patterns in text and search for matches
C) To implement recursive functions
D) To parse XML documents
Answer: B

Which automaton is used to recognize regular languages?


A) Turing machine
B) Pushdown automaton
C) Finite automaton
D) Context-free grammar
Answer: C

Arden's theorem is used for what purpose in regular expressions?


A) Simplifying regular expressions
B) Converting regular expressions to context-free grammars
C) Adding null moves to finite automata
D) Minimizing deterministic finite automata
Answer: A

What does NDFA stand for in the context of regular expressions and automata?
A) Non-Deterministic Finite Automaton
B) Null-Deterministic Finite Automaton
C) Non-Deterministic Finite Algorithm
D) None of the above
Answer: A

Which operation can be used to concatenate two regular expressions?


A) +
B) |
C) .
D) *
Answer: C

The Pumping Lemma is used to prove that a language is not:


A) Context-free
B) Regular
C) Recursive
D) Context-sensitive
Answer: B

Which of the following operations is NOT closure property of regular sets?


A) Union
B) Intersection
C) Concatenation
D) Exponentiation
Answer: D

What is the purpose of constructing a deterministic finite automaton (DFA) equivalent to a regular express
ion?
A) To simplify the regular expression
B) To add null moves to the DFA
C) To minimize the number of states
D) To make the automaton non-deterministic
Answer: C

Which theorem is used to prove that two regular expressions are equivalent?
A) Pumping Lemma
B) Myhill-Nerode Theorem
C) Arden's Theorem
D) Kleene's Theorem
Answer: B

What does NDFA stand for when considering null moves in finite automata?
A) Non-Deterministic Finite Automaton
B) Null-Deterministic Finite Automaton
C) Non-Deterministic Finite Algorithm
D) Null-Deterministic Finite Algorithm
Answer: B

Which of the following is a closure property of regular sets?


A) Complement
B) Exponentiation
C) Intersection
D) Division
Answer: C

What is the purpose of the Myhill-Nerode Theorem?


A) To simplify regular expressions
B) To determine whether a language is regular or not
C) To prove the equivalence of two context-free grammars
D) To convert regular expressions to finite automata
Answer: B

Which of the following is NOT a valid regular expression operator?


A) ?
B) +
C) !
D) *
Answer: C

What is the primary function of the transition system containing null moves in regular expressions?
A) To eliminate null moves from finite automata
B) To add null moves to finite automata
C) To convert regular expressions to context-free grammars
D) To simplify regular expressions
Answer: B

Which theorem is used for constructing finite automata equivalent to a regular expression?
A) Arden's Theorem
B) Pumping Lemma
C) Kleene's Theorem
D) Myhill-Nerode Theorem
Answer: A

In regular expressions, what does the "|" symbol represent?


A) Concatenation
B) Union
C) Kleene closure
D) Intersection
Answer: B

What is the main purpose of converting non-deterministic systems to deterministic systems in automata th
eory?
A) To simplify regular expressions
B) To eliminate null moves
C) To make the automaton non-regular
D) To improve computational efficiency
Answer: D

Which of the following is a valid regular expression for matching any string of digits?
A) [0-9]+
B) (0-9)*
C) [0-9]*
D) [0-9]?
Answer: C

Which closure property allows you to combine two regular sets to create a new regular set?
A) Concatenation
B) Intersection
C) Complement
D) Exponentiation
Answer: A

What is the purpose of the "Kleene closure" in regular expressions?


A) To perform exponentiation
B) To match zero or more occurrences of a pattern
C) To find the intersection of two regular expressions
D) To simplify regular expressions
Answer: B

Which theorem is used to determine if two regular languages are equivalent?


A) Pumping Lemma
B) Myhill-Nerode Theorem
C) Arden's Theorem
D) Kleene's Theorem
Answer: B

In the context of regular expressions, what does the "*" operator represent?
A) Intersection
B) Kleene closure (zero or more repetitions)
C) Union
D) Complement
Answer: B
What does the Pumping Lemma for Regular Sets state about certain strings within a regular language?
A) All strings can be pumped to infinite length.
B) All strings have exactly one unique parse tree.
C) There exist strings that cannot be pumped to longer lengths while remaining in the language.
D) All strings can be pumped to a shorter length.
Answer: C

Which of the following is a non-deterministic finite automaton (NDFA) with null moves?
A) An automaton that can move to multiple states simultaneously
B) An automaton that always moves to the null state
C) An automaton that can move without consuming input
D) An automaton that cannot move between states
Answer: C

Which of the following is NOT a valid regular set operation?


A) Concatenation
B) Intersection
C) Exponentiation
D) Kleene closure
Answer: C

What is the purpose of the "Pumping Lemma" in the theory of regular sets?
A) To simplify regular expressions
B) To prove that certain languages are regular
C) To generate null moves in finite automata
D) To find the intersection of two regular expressions
Answer: B

Which operation allows you to combine two regular expressions to match either one or the other?
A) Intersection
B) Concatenation
C) Union
D) Kleene closure
Answer: C

What does Arden's Theorem provide a method for in the context of regular expressions?
A) Converting regular expressions to context-free grammars
B) Simplifying regular expressions with null moves
C) Adding null moves to finite automata
D) Determinizing non-deterministic systems
Answer: B

Which closure property allows you to find the intersection of two regular sets?
A) Concatenation
B) Union
C) Intersection
D) Complement
Answer: C

Which theorem is used to prove the equivalence of two regular expressions?


A) Pumping Lemma
B) Myhill-Nerode Theorem
C) Arden's Theorem
D) Kleene's Theorem
Answer: C

What is the primary purpose of constructing a deterministic finite automaton (DFA) equivalent to a regular
expression?
A) To simplify the regular expression
B) To make the automaton non-deterministic
C) To add null moves to the DFA
D) To minimize the number of states
Answer: D

Which operation in regular expressions represents the union of two sets?


A) .
B) *
C) |
D) +
Answer: C

What is the main goal of the Pumping Lemma for Regular Sets?
A) To simplify regular expressions
B) To prove that certain languages are context-free
C) To find the intersection of two regular expressions
D) To demonstrate that certain languages are not regular
Answer: D

Which closure property allows you to combine two regular sets end-to-end?
A) Concatenation
B) Union
C) Intersection
D) Complement
Answer: A

Which theorem is used to determine if two regular languages are equivalent?


A) Pumping Lemma
B) Myhill-Nerode Theorem
C) Arden's Theorem
D) Kleene's Theorem
Answer: B

In regular expressions, what does the "|" symbol represent?


A) Concatenation
B) Union
C) Kleene closure
D) Intersection
Answer: B

What is the primary function of the transition system containing null moves in regular expressions?
A) To eliminate null moves from finite automata
B) To add null moves to finite automata
C) To convert regular expressions to context-free grammars
D) To simplify regular expressions
Answer: B

Which theorem is used for constructing finite automata equivalent to a regular expression?
A) Arden's Theorem
B) Pumping Lemma
C) Kleene's Theorem
D) Myhill-Nerode Theorem
Answer: A

In regular expressions, what does the "+" operator represent?


A) Intersection
B) Union
C) Kleene closure (one or more repetitions)
D) Complement
Answer: C

What is the purpose of converting non-deterministic systems to deterministic systems in automata theory?

A) To simplify regular expressions


B) To eliminate null moves
C) To make the automaton non-regular
D) To improve computational efficiency
Answer: D

Which of the following is a valid regular expression for matching any string of digits?
A) [0-9]+
B) (0-9)*
C) [0-9]*
D) [0-9]?
Answer: C

Which closure property allows you to combine two regular sets to create a new regular set?
A) Concatenation
B) Intersection
C) Complement
D) Exponentiation
Answer: A

What is the purpose of the "Kleene closure" in regular expressions?


A) To perform exponentiation
B) To match zero or more occurrences of a pattern
C) To find the intersection of two regular expressions
D) To simplify regular expressions
Answer: B

Which theorem is used to determine if two regular languages are equivalent?


A) Pumping Lemma
B) Myhill-Nerode Theorem
C) Arden's Theorem
D) Kleene's Theorem
Answer: B

In the context of regular expressions, what does the "*" operator represent?
A) Intersection
B) Kleene closure (zero or more repetitions)
C) Union
D) Complement
Answer: B

What does the Pumping Lemma for Regular Sets state about certain strings within a regular language?
A) All strings can be pumped to infinite length.
B) All strings have exactly one unique parse tree.
C) There exist strings that cannot be pumped to longer lengths while remaining in the language.
D) All strings can be pumped to a shorter length.
Answer: C

Which of the following is a non-deterministic finite automaton (NDFA) with null moves?
A) An automaton that can move to multiple states simultaneously
B) An automaton that always moves to the null state
C) An automaton that can move without consuming input
D) An automaton that cannot move between states
Answer: C

Which of the following is NOT a valid regular set operation?


A) Concatenation
B) Intersection
C) Exponentiation
D) Kleene closure
Answer: C

What is the purpose of the "Pumping Lemma" in the theory of regular sets?
A) To simplify regular expressions
B) To prove that certain languages are regular
C) To generate null moves in finite automata
D) To find the intersection of two regular expressions
Answer: B

Which operation in regular expressions represents the union of two sets?


A) .
B) *
C) |
D) +
Answer: C

NUMERICAL BASED

How many strings of length 5 can be generated from the regular expression (01)*?
A) 16
B) 32
C) 64
D) 128
Answer: B

If the regular expression (a|b)* is used, how many different strings of length 4 are valid matches?
A) 8
B) 16
C) 32
D) 64
Answer: D

When converting the regular expression 0(01)* into an equivalent nondeterministic finite automaton (NFA)
with null moves, how many states will the NFA have?
A) 2
B) 3
C) 4
D) 5
Answer: B

For the regular expression (ab|cd)*, what is the minimum number of states required in the corresponding
deterministic finite automaton (DFA)?
A) 4
B) 8
C) 16
D) 32
Answer: C

If you compute the intersection of two regular languages: L1 = {0, 00, 000, ...} and L2 = {1, 11, 111, ...}, ho
w many strings will be in the intersection?
A) Infinite
B) None
C) Only one string
D) Two strings
Answer: B

Given the regular expression (a|b)*, how many different strings of length 5 can be generated?
A) 16
B) 32
C) 64
D) 128
Answer: D

If a regular expression represents all even-length strings over the alphabet {0, 1}, how many strings of len
gth 6 will it match?
A) 16
B) 32
C) 64
D) 128
Answer: C

Consider the regular expression (0|1)*. How many strings of length 7 can be generated from this expressi
on?
A) 64
B) 128
C) 256
D) 512
Answer: C

If a regular language contains 20 strings, and each string has a length of 3, how many strings of length 4
can be generated from this language using concatenation?
A) 20
B) 40
C) 60
D) 80
Answer: B

How many different strings can be generated from the regular expression (ab)*?
A) Infinite
B) None
C) One
D) Two
Answer: C

If a regular language contains 10 strings of length 5, how many strings of length 2 can be generated from
this language using concatenation?
A) 100
B) 50
C) 10
D) 20
Answer: C

If you concatenate two regular expressions, one matching strings of length 2 and the other matching strin
gs of length 3, how many strings of length 5 can be generated from the resulting expression?
A) 6
B) 9
C) 10
D) 15
Answer: B

If a regular expression matches all strings of length 3 or 4, how many strings of length 5 will it match?
A) 0
B) 16
C) 32
D) 64
Answer: A

If a regular expression matches strings of the form "abc" followed by any number of "xyz," how many strin
gs of this form are in the language?
A) Infinite
B) None
C) One
D) Two
Answer: C

How many different strings can be generated from the regular expression (01|10)*?
A) Infinite
B) None
C) One
D) Two
Answer: A

If a regular expression matches strings of the form "ab" followed by "cd," how many strings of this form ar
e in the language?
A) Infinite
B) None
C) One
D) Two
Answer: D

If you concatenate a regular expression matching strings of length 2 with a regular expression matching st
rings of length 3, how many strings of length 6 can be generated from the resulting expression?
A) 6
B) 9
C) 10
D) 15
Answer: A
If a regular expression matches all strings of length 2 or 3, how many strings of length 4 will it match?
A) 0
B) 16
C) 32
D) 64
Answer: A

How many different strings can be generated from the regular expression (01|10)*?
A) Infinite
B) None
C) One
D) Two
Answer: A

If a regular expression matches strings of the form "ab" followed by "cd," how many strings of this form ar
e in the language?
A) Infinite
B) None
C) One
D) Two
Answer: D

Unit 3

Formal Languages, Grammars, and Chomsky Classification

What is a formal language in the context of computer science?


a) A language spoken in a formal setting
b) A language used for formal documentation
c) A language defined by a set of rules and symbols
d) A language used for formal debates
Answer: c) A language defined by a set of rules and symbols

Which of the following is NOT a component of a formal grammar?


a) Terminals
b) Non-terminals
c) Productions
d) Variables
Answer: d) Variables

In Chomsky's hierarchy of languages, which class includes all possible languages?


a) Regular languages
b) Context-free languages
c) Context-sensitive languages
d) Recursive languages
Answer: d) Recursive languages

Which type of grammar is most powerful in terms of generative capacity?


a) Type 0 (Recursively Enumerable)
b) Type 1 (Context-sensitive)
c) Type 2 (Context-free)
d) Type 3 (Regular)
Answer: a) Type 0 (Recursively Enumerable)

Regular Grammars

Which type of grammar corresponds to regular languages?


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: d) Type 3

Which of the following operations is NOT valid for regular expressions?


a) Union (|)
b) Concatenation (.)
c) Exponentiation (^)
d) Kleene Star (*)
Answer: c) Exponentiation (^)

Which of the following is a correct conversion of a regular expression to a regular grammar?


a) Regular expression to context-free grammar
b) Regular expression to context-sensitive grammar
c) Regular expression to regular grammar
d) Regular expression to recursive grammar
Answer: c) Regular expression to regular grammar

What is a left-linear regular grammar?


a) A regular grammar where all productions have terminals on the left-hand side
b) A regular grammar where all productions are left-associative
c) A regular grammar where all productions have non-terminals on the left-hand side
d) A regular grammar where all productions are written from left to right
Answer: a) A regular grammar where all productions have terminals on the left-hand side

Which of the following is true about right-linear regular grammars?


a) All productions are right-associative.
b) All productions have non-terminals on the right-hand side.
c) All productions have terminals on the right-hand side.
d) All productions are written from right to left.
Answer: c) All productions have terminals on the right-hand side.

What is the language generated by the regular expression (a|b)*abb?


a) All strings containing 'abb' as a substring
b) All strings that end with 'abb'
c) All strings that start with 'abb'
d) All strings containing 'abb' exactly three times
Answer: b) All strings that end with 'abb'

Which of the following is true about regular languages?


a) They can be recognized by a Turing machine.
b) They can be recognized by a pushdown automaton.
c) They can be recognized by a finite automaton.
d) They can be recognized by a context-sensitive grammar.
Answer: c) They can be recognized by a finite automaton.

In the Chomsky hierarchy, which type of language corresponds to regular languages?


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: d) Type 3

What is the Kleene star (*) operation used for in regular expressions?
a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: d) Denoting repetition zero or more times

Which of the following is NOT a property of regular languages?


a) Closure under union
b) Closure under intersection
c) Closure under concatenation
d) Closure under complementation
Answer: b) Closure under intersection

Which class of automata can recognize regular languages?


a) Turing machines
b) Pushdown automata
c) Finite automata
d) Context-sensitive automata
Answer: c) Finite automata

Which of the following is a correct conversion of a regular grammar to a regular expression?


a) Regular grammar to context-free grammar
b) Regular grammar to context-sensitive grammar
c) Regular grammar to regular expression
d) Regular grammar to recursive grammar
Answer: c) Regular grammar to regular expression

Which type of regular grammar generates a language that can be read from left to right?
a) Left-linear regular grammar
b) Right-linear regular grammar
c) Both left-linear and right-linear regular grammars
d) Neither left-linear nor right-linear regular grammars
Answer: b) Right-linear regular grammar

What is the purpose of the dot (.) operator in regular expressions?


a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: c) Denoting concatenation

Which Chomsky hierarchy type corresponds to context-free grammars?


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: c) Type 2

Which of the following statements is true about regular grammars?


a) They can generate context-sensitive languages.
b) They can generate context-free languages.
c) They can generate regular languages.
d) They can generate recursively enumerable languages.
Answer: c) They can generate regular languages.

In Chomsky's hierarchy, which class of languages is most restricted in generative power?


a) Type 0 (Recursively Enumerable)
b) Type 1 (Context-sensitive)
c) Type 2 (Context-free)
d) Type 3 (Regular)
Answer: d) Type 3 (Regular)

What is the primary characteristic of regular sets and regular grammars?


a) They can generate any language.
b) They can generate context-free languages.
c) They are limited in expressive power.
d) They are Turing complete.
Answer: c) They are limited in expressive power.

Which operation is NOT valid for regular expressions?


a) Union (|)
b) Concatenation (.)
c) Exponentiation (^)
d) Kleene Closure (*)
Answer: c) Exponentiation (^)

What is the purpose of the vertical bar (|) in regular expressions?


a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: b) Denoting alternative choices

Which of the following is a correct conversion of a regular grammar to a regular expression?


a) Regular grammar to context-free grammar
b) Regular grammar to context-sensitive grammar
c) Regular grammar to regular expression
d) Regular grammar to recursive grammar
Answer: c) Regular grammar to regular expression

Which of the following is true about regular languages?


a) They can be recognized by a Turing machine.
b) They can be recognized by a pushdown automaton.
c) They can be recognized by a finite automaton.
d) They can be recognized by a context-sensitive grammar.
Answer: c) They can be recognized by a finite automaton.

In the Chomsky hierarchy, which type of language corresponds to regular languages?


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: d) Type 3
What is the Kleene star (*) operation used for in regular expressions?
a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: d) Denoting repetition zero or more times

Which of the following is NOT a property of regular languages?


a) Closure under union
b) Closure under intersection
c) Closure under concatenation
d) Closure under complementation
Answer: b) Closure under intersection

Which class of automata can recognize regular languages?


a) Turing machines
b) Pushdown automata
c) Finite automata
d) Context-sensitive automata
Answer: c) Finite automata

Which of the following is a correct conversion of a regular grammar to a regular expression?


a) Regular grammar to context-free grammar
b) Regular grammar to context-sensitive grammar
c) Regular grammar to regular expression
d) Regular grammar to recursive grammar
Answer: c) Regular grammar to regular expression

Which type of regular grammar generates a language that can be read from left to right?
a) Left-linear regular grammar
b) Right-linear regular grammar
c) Both left-linear and right-linear regular grammars
d) Neither left-linear nor right-linear regular grammars
Answer: b) Right-linear regular grammar

What is the purpose of the dot (.) operator in regular expressions?


a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: c) Denoting concatenation

Which Chomsky hierarchy type corresponds to context-free grammars?


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: c) Type 2

Which of the following statements is true about regular grammars?


a) They can generate context-sensitive languages.
b) They can generate context-free languages.
c) They can generate regular languages.
d) They can generate recursively enumerable languages.
Answer: c) They can generate regular languages.
In Chomsky's hierarchy, which class of languages is most restricted in generative power?
a) Type 0 (Recursively Enumerable)
b) Type 1 (Context-sensitive)
c) Type 2 (Context-free)
d) Type 3 (Regular)
Answer: d) Type 3 (Regular)

What is the primary characteristic of regular sets and regular grammars?


a) They can generate any language.
b) They can generate context-free languages.
c) They are limited in expressive power.
d) They are Turing complete.
Answer: c) They are limited in expressive power.

Which operation is NOT valid for regular expressions?


a) Union (|)
b) Concatenation (.)
c) Exponentiation (^)
d) Kleene Closure (*)
Answer: c) Exponentiation (^)

What is the purpose of the vertical bar (|) in regular expressions?


a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: b) Denoting alternative choices

Which of the following is a correct conversion of a regular grammar to a regular expression?


a) Regular grammar to context-free grammar
b) Regular grammar to context-sensitive grammar
c) Regular grammar to regular expression
d) Regular grammar to recursive grammar
Answer: c) Regular grammar to regular expression

Which type of regular grammar generates a language that can be read from left to right?
a) Left-linear regular grammar
b) Right-linear regular grammar
c) Both left-linear and right-linear regular grammars
d) Neither left-linear nor right-linear regular grammars
Answer: b) Right-linear regular grammar

What is the purpose of the dot (.) operator in regular expressions?


a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: c) Denoting concatenation

Which Chomsky hierarchy type corresponds to context-free grammars?


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: c) Type 2

Which of the following statements is true about regular grammars?


a) They can generate context-sensitive languages.
b) They can generate context-free languages.
c) They can generate regular languages.
d) They can generate recursively enumerable languages.
Answer: c) They can generate regular languages.

In Chomsky's hierarchy, which class of languages is most restricted in generative power?


a) Type 0 (Recursively Enumerable)
b) Type 1 (Context-sensitive)
c) Type 2 (Context-free)
d) Type 3 (Regular)
Answer: d) Type 3 (Regular)

What is the primary characteristic of regular sets and regular grammars?


a) They can generate any language.
b) They can generate context-free languages.
c) They are limited in expressive power.
d) They are Turing complete.
Answer: c) They are limited in expressive power.

Which operation is NOT valid for regular expressions?


a) Union (|)
b) Concatenation (.)
c) Exponentiation (^)
d) Kleene Closure (*)
Answer: c) Exponentiation (^)

What is the purpose of the vertical bar (|) in regular expressions?


a) Denoting optional characters
b) Denoting alternative choices
c) Denoting concatenation
d) Denoting repetition zero or more times
Answer: b) Denoting alternative choices

Which of the following is a correct conversion of a regular grammar to a regular expression?


a) Regular grammar to context-free grammar
b) Regular grammar to context-sensitive grammar
c) Regular grammar to regular expression
d) Regular grammar to recursive grammar
Answer: c) Regular grammar to regular expression

Which type of regular grammar generates a language that can be read from left to right?
a) Left-linear regular grammar
b) Right-linear regular grammar
c) Both left-linear and right-linear regular grammars
d) Neither left-linear nor right-linear regular grammars
Answer: b) Right-linear regular grammar

Numerical Questions

How many productions are in a regular grammar that generates the language {a, b}?
a) 2
b) 3
c) 4
d) Infinite
Answer: a) 2

What is the minimum number of states required for a finite automaton to accept the language L = {0, 1}?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2

If a regular expression has 4 symbols (e.g., a, b, c, d), how many possible strings can it generate of length
3 or less?
a) 64
b) 32
c) 16
d) 8
Answer: c) 16

How many states are in the minimal DFA that accepts the language L = {w | w contains an even number o
f 1s} over the alphabet {0, 1}?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2

If a context-free grammar has 5 non-terminals and 8 productions, how many terminals can it have at most
?
a) 4
b) 5
c) 6
d) 7
Answer: c) 6

How many different strings of length 5 can be generated using an alphabet with 4 symbols?
a) 20
b) 25
c) 64
d) 1024
Answer: d) 1024

If a regular grammar has 3 non-terminals and 6 productions, how many terminals can it have at most?
a) 3
b) 4
c) 5
d) 6
Answer: b) 4

What is the maximum number of states in a non-deterministic finite automaton (NFA) with n states?
a) n
b) 2^n
c) n!
d) 2n
Answer: b) 2^n

If a regular expression has 3 symbols (e.g., x, y, z), how many possible strings can it generate of length 2
or less?
a) 9
b) 6
c) 3
d) 1
Answer: a) 9

How many strings of length 4 can be generated using an alphabet with 3 symbols?
a) 12
b) 16
c) 81
d) 64
Answer: b) 16

If a context-free grammar has 4 non-terminals and 10 productions, how many terminals can it have at mo
st?
a) 3
b) 4
c) 5
d) 6
Answer: c) 5

What is the maximum number of states in a deterministic finite automaton (DFA) that accepts the languag
e L = {w | w has at most two 1s} over the alphabet {0, 1}?
a) 1
b) 2
c) 3
d) 4
Answer: c) 3

How many different strings of length 6 can be generated using an alphabet with 5 symbols?
a) 15625
b) 7776
c) 46,656
d) 10,000
Answer: a) 15625

If a regular grammar has 2 non-terminals and 4 productions, how many terminals can it have at most?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2

What is the minimum number of states required for a finite automaton to accept the language L = {w | w h
as an odd number of 1s} over the alphabet {0, 1}?
a) 1
b) 2
c) 3
d) 4
Answer: b) 2
If a context-free grammar has 6 non-terminals and 12 productions, how many terminals can it have at mo
st?
a) 5
b) 6
c) 7
d) 8
Answer: b) 6

How many different strings of length 3 can be generated using an alphabet with 2 symbols?
a) 2
b) 4
c) 6
d) 8
Answer: b) 4

What is the maximum number of states in a non-deterministic finite automaton (NFA) with 4 states?
a) 4
b) 8
c) 16
d) 32
Answer: d) 32

If a regular expression has 2 symbols (e.g., p, q), how many possible strings can it generate of length 4 or
less?
a) 16
b) 8
c) 4
d) 2
Answer: a) 16

How many strings of length 5 can be generated using an alphabet with 6 symbols?
a) 30
b) 125
c) 7776
d) 15625
Answer: c) 7776

You might also like