Academy of Tech Ology Questio BA K: Formal La Guage A D Automata Thory (PCC Cs403) 4 Sem Cse
Academy of Tech Ology Questio BA K: Formal La Guage A D Automata Thory (PCC Cs403) 4 Sem Cse
QUESTION BANK
FORMAL LANGUAGE AND AUTOMATA THORY (PCC CS403)
4TH SEM CSE
Faculty Name: Dr. Partha Ghosh & Prof. Uday Kumar Mondal
Course Outcomes (CO): At the end of this module the students will be able to
Question:
MODULE 1: Introduction
BLOOM’S TEXANOMY LEVEL: 1 (Remembering)
SL NO QUESTIONS MARK CO
S NO
1 What is the Chomsky hierarchy of languages? 5 1,3
SL NO QUESTIONS MARK CO
S NO
1 Describe the relationship between automata and formal languages. 5 1
SL NO QUESTIONS MARK CO
S NO
1 Define trap / dead state of DFA. Explain with example. 5 1
2 Define DFA with example 5 1
SL NO QUESTIONS MARK CO
S NO
1 If S is the number of states in NDFA then equivalent DFA can 1 1
have maximum of
(a) S states (b) S - 1 state
(c) 2s states (d) 2s – 1 states
7 The DFA: 1 1
8 The DFA: 1 1
Accepts:
a) Odd number of 0
b) Even number of 1
c) Even number of 0
d) Even number of 0 and Even number of 1
9 Number of states require in a DFA to accept string ends with 10. 1 1
A) 3
B) 2
C) 1
D) can’t be represented.
10 Extended transition function is . 1 1
a) Q * Σ* -> Q
b) Q * Σ -> Q
c) Q* * Σ* -> Σ
d) Q * Σ -> Σ
11 δ*(q,ya) is equivalent to . 1 1
a) δ((q,y),a)
b) δ(δ*(q,y),a)
c) δ(q,ya)
d) independent from δ notation
12 String X is accepted by finite automata if . 1 1
a) δ*(q,x) E A
b) δ(q,x) E A
c) δ*(Q0,x) E A
d) δ(Q0,x) E A
11 Finite automata requires minimum _______ number of stacks. 1 1
a) 1
b) 0
c) 2
d) None of the mentioned
12 The basic limitation of finite automata is that 1 1
a) It can’t remember arbitrary large amount of information.
b) It sometimes recognize grammar that are not regular.
c) It sometimes fails to recognize regular grammar.
d) All of the mentioned
13 Design a FA with ∑ = {0, 1} accepts those string which 4 2
starts with 1 and ends with 0.
14 Design FA with ∑ = {0, 1} accepts even number of 0's and 4 1
even number of 1's.
15 Design FA with ∑ = {0, 1} accepts the set of all strings with 4 1
three consecutive 0's
16 Design an NFA in which all the string contain a substring 4 1
1110.
17 Number of states require in a DFA to accept string anbn, where n>0. 1 1
a) 3
b) 2
c) 6
d) can’t be represented.
18 Number of states require in a DFA to accept string ends with 101. 1 1
a) 3
b) 2
c) 4
d) can’t be represented.
19 Number of states require in a DFA to accept string starts with 1 1
aaa.
a) 6 b) 5 c) 4 d) can’t be represented.
20. Using the pumping Lemma prove that L ={an bn | n>=1} is not 4 1
regular.
SL NO QUESTION MA CO
RKS NO
1 Convert the given NFA to DFA. 5 1
5 5 1
Design a DFA over ∑ ={a,b} that accepts string having even number of a and odd number
of b.
6 5 1
Design a DFA over ∑ ={0,1} that accepts string ends with 101.
7 Design a DFA over ∑ ={a,b} that accepts string having anbm , where n,m>0 5 1
a*(a+b)b*
(0+1)*(00+11)(0+1)*
SL NO QUESTIONS MARKS CO
NO
1 Analyze Myhill-Nerode theorem and its applications in 5 2
formal language theory, particularly in determining the
equivalence of languages and minimizing finite automata.
Provide examples to illustrate its uses.
2 Determine the pumping length for a regular language 5 1
defined by a regular expression with m symbols using the
pumping lemma.
SL QUESTIONS MARKS CO
NO NO
1 Explain the concept of a pushdown automaton (PDA) and 5 5
its components.
SL QUESTIONS MARKS CO
NO NO
1 Which of the following defines a context-free grammar 1 5
(CFG)?
A) A grammar that generates regular languages.
B) A grammar that generates context-sensitive languages.
C) A grammar in Chomsky normal form.
D) A grammar with production rules of the form A → α,
where A is a non-terminal symbol and α is a string of
terminals and non-terminals.
2 What is the purpose of parse trees in the context of context- 1 5
free grammars?
A) To represent the structure of a derivation of a string.
B) To determine whether a string is in the language
generated by the grammar.
C) To minimize the number of states in a pushdown
automaton.
D) To generate strings by applying production rules.
Ambiguity in context-free grammars refers to: 1 5
3 A) The inability to generate certain types of languages.
B) The presence of multiple parse trees for the same
string.
C) The complexity of the language generated by the
grammar.
D) The lack of closure properties in context-free languages.
4 What does the pumping lemma for context-free languages 1 5
state?
A) It provides a method for parsing ambiguous context-free
grammars.
B) It proves that every context-free language is regular.
C) It establishes the closure properties of context-free
languages.
D) It identifies certain properties of context-free
languages regarding string lengths.
5 Which of the following accurately describes a deterministic 3 5
pushdown automaton (DPDA)?
A) A DPDA can process strings in reverse order compared
to an NPDA.
B) A DPDA may have multiple transitions for the same
input-symbol and state combination.
C) A DPDA always has a unique next move given its
current configuration.
D) A DPDA can recognize non-context-free languages.
6 What are the closure properties of context-free languages? 1 5
A) They define the behavior of context-free grammars when
applied to regular languages.
B) They describe the effect of operations such as union,
concatenation, and Kleene closure on context-free
languages.
C) They determine the number of states required in a
pushdown automaton to recognize a given language.
D) They specify the conditions under which a context-free
language becomes regular.
7 How does non-determinism in pushdown automata affect 1 5
their computational capabilities?
A) It allows them to recognize only regular languages.
B) It enables them to recognize context-sensitive languages.
C) It increases their efficiency in recognizing certain
types of languages.
D) It makes them equivalent in expressive power to
deterministic pushdown automata.
8 Which of the following is not a characteristic of context- 1 5
free languages?
A) They can be recognized by a pushdown automaton.
B) They can be described by context-free grammars.
C) They exhibit ambiguity in their syntax.
D) They are closed under the operation of intersection.
9 Explain the utility of parse trees. 4 5
SL NO QUESTIONS MARKS CO
NO
1 Show that the following grammar is ambiguous: 5 5
Sa | abSb | aAb
AbS | a AA b
SL NO QUESTIONS MARKS CO
NO
1 Compare and contrast nondeterministic pushdown automata 5 5
(NPDA) and deterministic pushdown automata (DPDA),
highlighting their differences in terms of language recognition
capabilities.
2 Consider a context-free grammar (CFG) with the following 5 5
productions:
S → aSb | ε
Analyze the given CFG to determine its language. Provide a detailed
explanation of your analysis.
3 Compare and contrast the closure properties of context-free 5 5
languages (CFLs) with those of regular languages. Discuss similarities
and differences, providing examples to illustrate your points.
SL QUESTIONS MARKS CO
NO NO
1 Define context-sensitive languages and provide examples. 3 3
SL QUESTIONS MARKS CO
NO NO
1 Which of the following is NOT a closure property of 1 3
context-sensitive languages?
a) Closure under union
b) Closure under intersection
c) Closure under concatenation
d) Closure under complement
2 Linear Bounded Automata (LBA) are equivalent in power 1 3
to which of the following?
a) Context-free grammars b) Regular expressions
c) Context-sensitive grammars d) Turing machines
The emptiness problem for linear bounded automata is: 1 3
3 a) Decidable b) Undecidable
c) Semi-decidable d) None of the above
4 Discuss the closure properties of context-sensitive 3 3
languages under union, concatenation, and intersection.
5 Explain the concept of Linear Bounded Automata (LBA) 4 3
and its significance in recognizing context-sensitive
languages.
6 Which of the following is true for the language {ap│p is a 1 3
prime}?
(a) It is not accepted by a Turing machine
(b) It is regular but not context- free
(c) It is context free but not regular
(d) it is neither regular nor context free ,but accepted by
a Turing machine.
SL NO QUESTIONS MARKS CO
NO
1 Design a LBA for language L = { anbncn | n ≥ 1) over the 5 3
alphabet {a,b,c}.
2 Design a LBA for language L = {an | n = m2, m ≥ 1}, 5 3
means n is perfect square.
SL QUESTIONS MARKS CO
NO NO
1 Which of the following is a characteristic of Turing 1 6
machines (TM)?
a) Finite number of states b) Limited tape alphabet
c) Unbounded tape d) Restricted tape movement
2 A language is Turing-recognizable if: 1 6
a) It can be generated by a context-sensitive grammar
b) A Turing machine halts and accepts all inputs
c) It is recursively enumerable
d) It is regular
3 Define Turing machine with an example. 5 6
4 Define nondeterministic Turing machine 4 6
SL QUESTIONS MARKS CO
NO NO
1 Turing machines are capable of simulating which of the 1 6
following?
a) Finite automata
b) Pushdown automata
c) Both finite and pushdown automata
d) Neither finite nor pushdown automata
2 A language is Turing-decidable if: 1 6
a) It can be recognized by a Turing machine
b) It can be generated by a context-sensitive grammar
c) A Turing machine halts and accepts or rejects all
inputs
d) It is recursively enumerable
Explain the difference between Turing-recognizable 4 6
3 (recursively enumerable) and Turing-decidable (recursive)
languages.
4 Prove or disprove the equivalence between nondeterministic 4 6
Turing machines and deterministic Turing machines in
terms of language recognition.
5 Discuss the relationship between unrestricted grammars and 4 6
Turing machines. Explain how unrestricted grammars can
generate languages recognized by Turing machines.
6 Discuss real-world applications of Turing machines or their 5 6
variants. Explain how Turing machines or their concepts are
used in computational theory or practical computing
systems.
7 Explain the concept of a Multi-tape Turing machine. 5 6
BLOOM’S TEXANOMY LEVEL: 3 (Applying)
SL NO QUESTIONS MARKS CO
NO
1 Construct a Turing Machine for language L = {ww | w ∈ 5 6
{0,1}}
2 Design Turing machine for language L = { anbncn | n ≥ 1) 5 6
over the alphabet {a,b,c}.
3 Design Turing machine for language L = { anbn | n ≥ 1) 5 6
over the alphabet {a,b}.
4 Construct TM for the addition function for the unary 4 6
number system.
5 Construct a TM machine for checking the palindrome of 5 6
the string of odd length.
6 Construct a TM machine for checking the palindrome of 5 6
the string of even length.
7 Construct a TM over the alphabet {0,1,2} for the 5 6
language L = {0n1n2n}, where n≥1
SL NO QUESTIONS MARKS CO
NO
1 Compare and contrast Deterministic Turing machines and 5 6
Nondeterministic Turing machines.
2 Compare and contrast Multi-tape Turing machines with 5 6
standard single-tape Turing machines, discussing their
advantages and limitations.
MODULE 6: Undecidability
BLOOM’S TEXANOMY LEVEL: 1 (Remembering)
SL QUESTIONS MARKS CO
NO NO
1 What is the Church-Turing thesis? 4 3
SL QUESTIONS MARKS CO
NO NO
1 Describe the construction and operation of a universal 5 3
Turing machine. Explain how a universal Turing machine
can simulate any other Turing machine.
2 Explain the Church-Turing thesis and its significance in the 4 3
theory of computation.
Define the concept of universal and diagonalization 4 3
3 languages
4 Discuss the implications of undecidability results for 4 3
practical computing and algorithm design.
5 Explain how undecidability influences the development of 4 3
algorithms and the limitations of automated reasoning
systems.
6 Discuss the implications of undecidability results for 4 3
practical computing and algorithm design.
1. What does the term "automata" refer to in the context of computer science?
○ A) Software programs
○ B) Formal languages
○ C) Mathematical models of computation
○ D) Hardware components
○ Answer: C) Mathematical models of computation
2. In the context of formal languages, what does an "alphabet" represent?
○ A) Alphabet
○ B) Syntax
○ C) Semantics
○ D) Production rules
Answer: C) Semantics
4. What is the purpose of production rules in formal grammars?
○ A) Regular grammar
○ B) Context-free grammar
○ C) Context-sensitive grammar
○ D) Type-0 grammar
Answer: D) Type-0 grammar
Module 2
○ a) Σ × Q -> Σ
○ b) Q × Q -> Σ
○ c) Σ × Σ -> Q
○ d) Q × Σ -> Q
Answer: d) Q × Σ -> Q
○ a) Σ × Q --> Σ
○ b) Q × Q --> Σ
○ c) Q × {Σ ∪ ε} --> 2Q
○ d) Q × Σ --> Q
Answer: c) Q × {Σ ∪ ε} --> 2Q
○ a) 4
○ b) 5
○ c) 6
○ d) unlimited
○ Answer: b) 5
Summary
○ The human eye and a camera have similar mechanisms, with the eye using
the pupil to control light, and the camera using the shutter. Both have lenses
and image sensing mechanisms, though the way focus is adjusted differs.
3. Comparison of Bird Flying and Aircraft:
○ Birds use metabolic energy and flap their wings, while airplanes use fuel and
have fixed wings designed for lift based on Bernoulli’s principle.
4. Importance of Biology:
2. What is the main source of energy for living creatures according to Julius
Robert von Mayer?
○ A. Light energy
○ B. Nuclear energy
○ C. Chemical energy from oxidation
○ D. Thermal energy
5. Which scientist explained Brownian motion and helped prove the existence of
atoms?
○ A. Jean Perrin
○ B. Robert Brown
○ C. Albert Einstein
○ D. Julius Mayer
6. What is the primary function of the retina in the human eye?
○ A. Iris muscle
○ B. Ciliary muscle
○ C. Cornea muscle
○ D. Pupil muscle
9. What does Bernoulli’s principle explain in the context of aircraft wings?
○ A. 1827
○ B. 1842
○ C. 1905
○ D. 1908
11.Which of the following is a reason to study biology?
○ A. Thermodynamic Law
○ B. Brownian motion
○ C. Conservation of energy
○ D. Oxidation process
13.What is the primary energy source for flying birds?
○ A. Solar energy
○ B. Metabolic energy (ATP)
○ C. Wind energy
○ D. Fuel energy
14.What year did Julius Robert von Mayer propose that energy can neither be
created nor destroyed?
○ A. 1827
○ B. 1841
○ C. 1905
○ D. 1926
Scientists and Key Years
○ Enunciated the conservation of energy, forming the basis for the First Law of
Thermodynamics.
○ Proposed that plants convert light energy into chemical energy.
● Jean Perrin (1908):
Brownian motion (random motion of particles suspended in a fluid resulting from their
collison with fast moving molecules in the fluid) is named after the botanist Robert Brown,
who first discovered this phenomenon in 1827, while looking through a microscope at pollen
of the plant Clarkia pulchella immersed in water. In 1905, almost 80 years later, physicist
Albert Einstein published a research paper, where he modelled the motion of pollen as being
moved by individual water molecules, making one of his first big contribution to science.
This explanation of Brownian motion served as convincing evidence that atoms and
molecules exist and was further verified experimentally by Jean Perrin in 1908. Perrin was
awarded Nobel Prize in Physics in 1926.
Julius R. Mayer was a German physician. He is best known for enunciating in 1841, one of
the original statements of the conservation of energy, or what is known as one of the first
version of ‘First Law of Thermodynamics’, namely, energy can neither be created nor
destroyed. He proposed that plants convert light energy into chemical energy. In, 1842,
Mayer described the vital chemical process, now referred to as oxidation as the primary
source of energy for any living creature.
MCQ on Hardness of water
1. Permanent hardness of water cannot be removed by which one of the following methods?
(a) Treatment with washing soda, (b) Calgon’s method
(c) Boiling, (d) Ion-exchange method
2. Temporary hardness of water arises due to the presence of
(a) 𝐻𝐶𝑂 , (b) 𝐶𝑂 , (c) 𝐶𝑙 , (d) 𝑆𝑂
3. The unit of hardness of water is generally expressed as
(a) 𝑔𝑚⁄𝑙 , (b) 𝑔𝑚 𝑚𝑜𝑙𝑒𝑠⁄𝑙 , (c) 𝑔𝑚 𝑒𝑞𝑢𝑖𝑣 ⁄𝑙 , (d) 𝑚𝑔⁄𝑙
4. Which one of the following water samples is expected to have the least hardness?
(a) Sea water, (b) Pond water, (c) Ground water, (d) Tap water.
5. Adding lime in water will remove which one of the following type of hardness of water?
(a) Nitrates of 𝐶𝑎 , (b) Chlorides of 𝐶𝑎 ,
(c) Bicarbonates of 𝐶𝑎 , (d) Sulphates of 𝐶𝑎 .
6. Which one of the following should have the highest hardness value in ppm?
(a) Tap water, (b) Rain water, (c) Sea water, (d) River water.
7. Which one of the following is true? Carbonates and bicarbonates
(a) are acidic, (b) are alkaline, (c) are neutral, (d) form lather with soap
8. Hardness of water arises due to the presence of salts of
(a) K, (b) Ca, (c) Al, (d) Cr.
9. Which one of the following is used in softening of hard water?
(a) 𝐴𝑙 (𝑂𝐻) , (b) 𝐶𝑎𝐶𝑂 , (c) 𝐶𝑎(𝑂𝐻) , (d) 𝑀𝑔(𝑂𝐻)
2. In a pipelined CPU, each instruction is executed in multiple stages. What are the common pipeline stages?
3. If a pipeline has 'K' stages and 'n' instructions, how many clock cycles are required to complete execution?
a) K * n
b) K + n - 1
c) n / K
d) K + n
Answer: b) K + n - 1
a) Structural hazard
b) Data hazard
c) Control hazard
d) Instruction hazard
c) Speeding up execution
a) Registers
b) Pipeline stages
c) Instructions
d) Data dependencies
a) Control hazard
b) Data hazard
c) Structural hazard
d) Instruction hazard
Answer: b) Data hazard
10. The speed-up of a pipelined architecture compared to a non-pipelined one is given by:
a) (n * K) / (K + n - 1)
b) K / n
c) K * n
d) 1 / (K + n)
Answer: a) (n * K) / (K + n - 1)
a) CPU pipeline
c) Asynchronous pipeline
d) Feedback pipeline
13. In a 4-stage pipeline with stage delays 10 ns, 15 ns, 12 ns, and 8 ns, what is the clock cycle time?
a) 8 ns
b) 10 ns
c) 15 ns
d) 12 ns
Answer: c) 15 ns
18. Which of these pipelines can be dynamically reconfigured for different tasks?
a) Static pipeline
b) Scalar pipeline
c) Multifunction pipeline
d) Linear pipeline
a) To synchronize stages
b) A slow stage
c) A non-functional pipeline
d) No execution delay
a) Number of stages
b) Data dependencies
c) Branching instructions
d) Cache size
a) Arithmetic pipeline
b) Instruction pipeline
c) Software pipeline
d) Execution pipeline
a) Data hazard
b) Structural hazard
c) Control hazard
d) Execution hazard
27. In a 5-stage pipeline, how many instructions can be in different stages at the same
time?
a) 1
b) 5
c) 10
d) Unlimited
Answer: b) 5
29. A 4-stage pipeline completes its first instruction in 10 ns per stage. How much time
will it take to complete 100 instructions?
a) 400 ns
b) 1000 ns
c) 1030 ns
d) 2000 ns
Answer: c) 1030 ns
33. Which type of pipeline delay occurs due to an instruction waiting for a previous
instruction's result?
a) Control hazard
b) Data hazard
c) Structural hazard
d) Execution hazard
a) 1
b) 2
c) Depends on CPU architecture
d) Unlimited
Answer: a) 1
35. Which of the following is NOT an advantage of pipelining?
36. Which hazard occurs when multiple instructions require the same resource
simultaneously?
a) Control hazard
b) Data hazard
c) Structural hazard
d) Instruction hazard
37. If a non-pipelined system takes 100 ns per instruction and a 5-stage pipeline reduces
it to 25 ns, what is the speedup?
a) 2x
b) 3x
c) 4x
d) 5x
Answer: d) 5x
a) Instruction pipeline
b) Arithmetic pipeline
c) Memory pipeline
d) Execution pipeline
a) Instruction size
b) Pipeline depth
c) Number of registers
d) Pipeline hazards
45. What is the primary function of the CPU scheduler in a pipelined processor?
a) Static pipeline
b) Scalar pipeline
c) Multifunction pipeline
d) Unifunction pipeline