🤖

Theory of Computation MCQ

Test your Theory of Computation knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.

100 Questions 40 Beginner 40 Intermediate 20 Advanced

How This Practice Test Works

Every question below expands right on this page — click a question to reveal its four options, pick the one you think is correct, and you'll get instant feedback along with the correct answer and a short explanation of the reasoning. Questions are grouped by difficulty, so start with the 40 beginner questions to confirm your fundamentals, work through the 40 intermediate ones, and finish with the 20 advanced questions that mirror what exams and technical screenings actually ask. There's no sign-up, no timer, and no limit — retake the test as often as you like.

Curated by Tech Baithak Editorial Team  ·  Last updated: June 2026

1

What is a finite automaton (FA)?

B

Correct Answer

An abstract machine with a finite set of states, transitions, and a defined start and accepting states

Explanation

A finite automaton (DFA or NFA) has a finite set of states, reads input one symbol at a time, and accepts if it ends in an accepting state. It recognizes regular languages.

2

What is a regular language?

B

Correct Answer

A language recognized by a finite automaton or described by a regular expression

Explanation

Regular languages are the simplest class in the Chomsky hierarchy. They are closed under union, concatenation, and Kleene star, and can be represented by DFA, NFA, or regex.

3

What does DFA stand for?

C

Correct Answer

Deterministic Finite Automaton

Explanation

A Deterministic Finite Automaton (DFA) has exactly one transition for each state-symbol pair, making its behavior fully deterministic.

4

What is the difference between a DFA and an NFA?

B

Correct Answer

An NFA can have multiple transitions for the same input and ε-transitions; a DFA has exactly one transition per state-symbol pair

Explanation

NFAs allow nondeterminism (multiple transitions, ε-moves). Every NFA can be converted to an equivalent DFA via the subset construction, though the DFA may have exponentially more states.

5

What is a regular expression?

B

Correct Answer

A pattern notation describing regular languages using union, concatenation, and Kleene star

Explanation

Regular expressions use ∪ (union), · (concatenation), and * (Kleene star) as basic operators. They describe exactly the class of regular languages.

6

What is a context-free grammar (CFG)?

A

Correct Answer

A grammar where every production replaces a single non-terminal

Explanation

In a CFG, each production rule has a single non-terminal on the left side (A → α). CFGs generate context-free languages, recognized by pushdown automata.

7

What type of automaton recognizes context-free languages?

C

Correct Answer

Pushdown Automaton (PDA)

Explanation

A Pushdown Automaton (PDA) extends a finite automaton with a stack, giving it the power to recognize context-free languages (e.g., balanced parentheses).

8

What is a Turing machine?

B

Correct Answer

An abstract machine with an infinite tape, read/write head, and finite control that models general computation

Explanation

A Turing machine can read/write symbols on an infinite tape and move left or right. It is the most powerful computational model, equivalent to any real computer.

9

What does the Church-Turing thesis claim?

A

Correct Answer

All computable functions can be computed by Turing machines

Explanation

The Church-Turing thesis is an informal hypothesis: anything intuitively computable can be computed by a Turing machine. It is not formally provable but is universally accepted.

10

What is the Halting Problem?

B

Correct Answer

The undecidable problem of determining whether a given Turing machine halts on a given input

Explanation

Turing proved that no Turing machine can decide for all programs whether they halt. The proof uses diagonalization and is a cornerstone of computability theory.

11

What is a decidable language?

B

Correct Answer

A language for which there exists a Turing machine that always halts and correctly accepts or rejects any input

Explanation

A decidable (recursive) language has a Turing machine that halts on all inputs — returning "accept" or "reject." Undecidable problems (like the Halting Problem) have no such TM.

12

What is the Chomsky hierarchy?

B

Correct Answer

A classification of formal languages into four types: regular, context-free, context-sensitive, and recursively enumerable

Explanation

Chomsky Type 3 (regular) ⊂ Type 2 (context-free) ⊂ Type 1 (context-sensitive) ⊂ Type 0 (recursively enumerable). Each type is recognized by a progressively more powerful automaton.

13

What does ε (epsilon) represent in formal language theory?

B

Correct Answer

The empty string (string of zero characters)

Explanation

ε represents the empty string. ε-transitions in NFAs allow state changes without consuming input. The set {ε} is not the empty language; the empty language is {}.

14

What is the Kleene star operation?

B

Correct Answer

Zero or more concatenations of strings from a language: L* = {ε} ∪ L ∪ LL ∪ LLL ∪ ...

Explanation

L* (Kleene closure) includes ε and all finite concatenations of strings from L. It is a fundamental operation for defining regular languages.

15

What is an ε-NFA?

B

Correct Answer

An NFA that permits transitions on ε (empty string) without consuming input

Explanation

ε-NFAs allow state changes on ε (no input consumed). Every ε-NFA can be converted to an equivalent DFA by computing ε-closures.

16

What is the language of a grammar?

A

Correct Answer

The set of all strings that can be derived from the start symbol using production rules

Explanation

L(G) is the set of all terminal strings derivable from the start symbol S. Every grammar defines a language.

17

What is a terminal symbol in a grammar?

B

Correct Answer

A symbol that cannot be replaced by any production rule; appears in the final generated string

Explanation

Terminals are the actual symbols of the language (letters, digits). Non-terminals are intermediate symbols that get replaced. Only terminals appear in final derived strings.

18

What is ambiguity in a context-free grammar?

B

Correct Answer

When a string has more than one leftmost derivation (or parse tree)

Explanation

A grammar is ambiguous if there exists a string that can be parsed in two different ways (two distinct parse trees or leftmost derivations). Ambiguity in programming language grammars causes operator precedence problems.

19

What is the union of two regular languages?

B

Correct Answer

A regular language (regular languages are closed under union)

Explanation

Regular languages are closed under union, concatenation, Kleene star, intersection, and complement. The union of two regular languages is always regular.

20

What is the complement of a language L over alphabet Σ?

B

Correct Answer

Σ* minus L — all strings over Σ not in L

Explanation

The complement of L is all strings over the same alphabet that are NOT in L. Regular languages are closed under complement; context-free languages are not.

21

What is a parse tree?

B

Correct Answer

A tree showing the derivation of a string from a grammar, with the start symbol as root and terminals as leaves

Explanation

Parse trees (derivation trees) represent how a string is derived from a grammar. They visualize the hierarchical structure and are used in compiler syntax analysis.

22

What is the language {aⁿbⁿ | n ≥ 0}?

B

Correct Answer

A context-free language that is not regular

Explanation

{aⁿbⁿ} is the classic example of a CFL that is not regular. A DFA cannot count arbitrarily, but a PDA can use its stack to count matching a's and b's.

23

What does it mean for a language to be recursively enumerable (RE)?

B

Correct Answer

There exists a Turing machine that accepts all strings in the language (but may loop on non-members)

Explanation

RE languages are recognized (accepted) by Turing machines that always halt on accepted strings but may loop forever on rejected strings. Decidable languages always halt on both.

24

What is a leftmost derivation?

B

Correct Answer

Always replacing the leftmost non-terminal at each step of a derivation

Explanation

In a leftmost derivation, the leftmost non-terminal is always expanded first. A rightmost derivation expands the rightmost. Both strategies are used in parser construction.

25

What is a dead state in a DFA?

B

Correct Answer

A non-accepting sink state that all inputs lead to and from which no accepting state is reachable

Explanation

A dead (trap) state is a non-accepting state from which the machine can never reach an accepting state. Once entered, the string will be rejected.

26

What is the state minimization of a DFA?

B

Correct Answer

Finding the unique smallest equivalent DFA by merging indistinguishable states

Explanation

The minimized DFA (Myhill-Nerode theorem) is unique and has the fewest states. States are merged if they are indistinguishable (same behavior on all input suffixes).

27

What does the subset construction algorithm do?

B

Correct Answer

Converts an NFA to an equivalent DFA by treating sets of NFA states as single DFA states

Explanation

Subset (powerset) construction: each DFA state is a set of NFA states reachable on the same input. An n-state NFA may produce up to 2ⁿ DFA states.

28

What is Greibach Normal Form (GNF)?

B

Correct Answer

A CFG where every production starts with a terminal followed by non-terminals

Explanation

GNF: every production is A → aB₁B₂...Bk where a is terminal and Bi are non-terminals. Any CFG can be converted to GNF. Useful for PDA construction.

29

What is Chomsky Normal Form (CNF)?

B

Correct Answer

A CFG where productions are either A → BC or A → a (two non-terminals or one terminal)

Explanation

CNF productions are A → BC (two non-terminals) or A → a (one terminal). Every CFG can be converted to CNF. CNF is used by the CYK parsing algorithm.

30

What is a linear bounded automaton (LBA)?

B

Correct Answer

A Turing machine whose tape is limited to the length of the input, recognizing context-sensitive languages

Explanation

An LBA is a nondeterministic Turing machine restricted to the tape length of the input. It recognizes exactly the context-sensitive languages (Type 1).

31

What is a transducer?

B

Correct Answer

A finite automaton that produces output, mapping input strings to output strings

Explanation

Transducers (Mealy and Moore machines) are FA with outputs. Mealy machines produce output on transitions; Moore machines produce output on states. Used in digital circuit design.

32

What is a language that is RE but not decidable?

B

Correct Answer

The Halting Problem language {<M,w> | M halts on w}

Explanation

The Halting Problem is RE (a TM can accept by simulating M on w until it halts) but undecidable (no TM always halts on both instances). Its complement is not even RE.

33

What is the CYK (Cocke-Younger-Kasami) algorithm?

B

Correct Answer

A dynamic programming algorithm that parses a string using a CNF grammar in O(n³ |G|) time

Explanation

CYK checks membership in a CFG (in CNF) using DP on all substrings. It fills a triangular table bottom-up in O(n³) time, determining if a string is generated by the grammar.

34

What is the difference between a recognizer and a decider?

B

Correct Answer

A recognizer halts on accepted strings but may loop on rejected ones; a decider always halts on both

Explanation

A TM recognizer (enumerator) accepts members of the language but may loop forever on non-members. A TM decider (solver) always halts with yes/no for all inputs.

35

What does it mean for a problem to be undecidable?

B

Correct Answer

No Turing machine can solve the problem for all inputs in finite time

Explanation

An undecidable problem has no algorithm that always terminates with the correct answer. This is a fundamental limitation of computation, not just current hardware.

36

What is a nondeterministic Turing machine (NTM)?

B

Correct Answer

A TM that can branch into multiple computation paths simultaneously, accepting if any path accepts

Explanation

An NTM explores multiple paths of computation simultaneously. While not physically realizable, it is theoretically equivalent to deterministic TMs in terms of language recognition (though potentially exponentially faster).

37

What is the significance of the Empty Language ∅ in formal languages?

B

Correct Answer

It is the language with no strings — not even ε

Explanation

∅ (empty set) is the language containing no strings at all, not even ε. The language {ε} contains exactly one string: the empty string. Both are regular languages.

38

What is a production rule in a grammar?

B

Correct Answer

A rule of the form α → β that replaces string α with string β in a derivation

Explanation

Production rules define how strings are derived. In CFGs, the left-hand side is a single non-terminal. In unrestricted grammars (Type 0), both sides can be any string.

39

What is a Moore machine?

A

Correct Answer

An automaton producing output based on the current state

Explanation

A Moore machine produces output that depends only on the current state. A Mealy machine produces output based on the current state AND input symbol.

40

What is the concatenation of languages L₁ and L₂?

B

Correct Answer

The set {xy | x ∈ L₁ and y ∈ L₂}

Explanation

L₁·L₂ = {xy | x ∈ L₁, y ∈ L₂} — strings formed by concatenating any string from L₁ with any string from L₂.

1

What is the Pumping Lemma for regular languages used for?

B

Correct Answer

Proving that a language is NOT regular by contradiction

Explanation

The Pumping Lemma states that every regular language has a pumping length p such that any string w with |w|≥p can be split as xyz with xy^i z in the language. Violating this proves non-regularity.

2

What language does the language {aⁿbⁿcⁿ | n ≥ 1} belong to?

C

Correct Answer

Context-Sensitive

Explanation

{aⁿbⁿcⁿ} is not context-free (proved by the CFL Pumping Lemma) but is context-sensitive. It requires counting three quantities simultaneously, which is beyond the power of a PDA's single stack.

3

What is a closure property in formal language theory?

B

Correct Answer

A language family is closed under an operation if applying that operation to languages in the family always yields a language in the same family

Explanation

Regular languages are closed under union, concatenation, star, intersection, and complement. Context-free languages are closed under union, concatenation, and star but not intersection or complement.

4

What does the Myhill-Nerode theorem characterize?

B

Correct Answer

Both the minimality of a DFA and the regularity of a language via equivalence classes of the right-congruence relation

Explanation

Myhill-Nerode: a language is regular iff it has finitely many right-congruence classes (≡_L). The number of classes equals the number of states in the minimal DFA.

5

What is Rice's theorem?

B

Correct Answer

Every non-trivial semantic property of Turing machine languages is undecidable

Explanation

Rice's theorem: for any non-trivial property P of RE languages (neither all TMs nor no TMs have it), the problem of deciding whether TM M has property P is undecidable.

6

What is the Earley parser algorithm used for?

B

Correct Answer

Parsing any CFG (including ambiguous ones) in O(n³) worst case and O(n) for unambiguous grammars

Explanation

Earley parsing handles any CFG without requiring transformations. It builds items (dotted rules) in a chart, making it versatile but O(n³) for ambiguous grammars.

7

What is the difference between LL and LR parsing?

B

Correct Answer

LL(k) scans left-to-right with leftmost derivation (top-down); LR(k) scans left-to-right with rightmost derivation in reverse (bottom-up)

Explanation

LL parsers (predictive, recursive descent) are top-down and handle a subset of CFGs. LR parsers (shift-reduce) are bottom-up and handle a larger class of CFGs without ambiguity.

8

What is the emptiness problem for CFGs?

B

Correct Answer

Determining if a CFG generates no strings — decidable

Explanation

The emptiness problem for CFGs is decidable: mark productive non-terminals (those deriving terminal strings), and check if S is marked. Equivalence is undecidable for CFGs.

9

What is reduction in computability theory?

B

Correct Answer

Transforming instances of problem A to problem B so that a solver for B solves A, proving B at least as hard as A

Explanation

If A reduces to B (A ≤ B), then B is at least as hard as A. If A is undecidable and A reduces to B, then B is also undecidable. Reductions are the primary tool for undecidability proofs.

10

What is the Post Correspondence Problem (PCP)?

B

Correct Answer

An undecidable problem of finding a sequence of tiles such that the top string concatenation equals the bottom string concatenation

Explanation

PCP: given pairs of strings (aᵢ, bᵢ), find a sequence i₁, i₂,..., iₖ such that a_{i₁}a_{i₂}...a_{iₖ} = b_{i₁}b_{i₂}...b_{iₖ}. Undecidable, useful for showing other problems undecidable.

11

What is the complexity class P?

B

Correct Answer

Problems decidable by a deterministic TM in polynomial time in the input size

Explanation

P contains problems solvable in O(nᵏ) time for some constant k. Examples: sorting, shortest paths, linear programming. P is believed to be a strict subset of NP.

12

What is the complexity class NP?

B

Correct Answer

Problems whose solutions can be verified in polynomial time by a deterministic TM (or solved in polynomial time by an NTM)

Explanation

NP is the class of problems with polynomial-time verifiable solutions (witnesses/certificates). Equivalently, solvable by a nondeterministic TM in polynomial time.

13

What is an NP-complete problem?

B

Correct Answer

A problem in NP to which every NP problem can be reduced in polynomial time (NP-hard + in NP)

Explanation

NP-complete problems are the hardest in NP. If any NP-complete problem is in P, then P = NP. Examples: SAT, 3-SAT, Vertex Cover, Hamiltonian Path.

14

What was the first problem proven NP-complete?

C

Correct Answer

Boolean Satisfiability (SAT) — by Cook's theorem 1971

Explanation

Cook's theorem (1971) proved that SAT is NP-complete. Karp then showed 21 other problems (including 3-SAT, Clique, Vertex Cover) are NP-complete by reduction from SAT.

15

What is the Pumping Lemma for context-free languages?

B

Correct Answer

For any CFL with pumping length p, every string w with |w|≥p can be written as uvxyz where |vy|≥1, |vxy|≤p, and uv^i xy^i z is in the language for all i≥0

Explanation

The CFL Pumping Lemma splits strings into 5 parts: uvxyz with two "pumpable" segments v and y. Violating it proves a language is not context-free (e.g., {aⁿbⁿcⁿ}).

16

What is the complexity class PSPACE?

B

Correct Answer

Problems decidable by a deterministic TM in polynomial space (but possibly exponential time)

Explanation

PSPACE contains all problems solvable in O(nᵏ) space. P ⊆ NP ⊆ PSPACE ⊆ EXP. PSPACE-complete examples: QBF (Quantified Boolean Formula), TQBF.

17

What is Savitch's theorem?

B

Correct Answer

NSPACE(f(n)) ⊆ DSPACE(f(n)²) — nondeterministic space can be simulated deterministically by squaring the space bound

Explanation

Savitch's theorem shows nondeterministic and deterministic space classes are close: NPSPACE(f) ⊆ DSPACE(f²). This implies PSPACE = NPSPACE.

18

What is the complexity class co-NP?

A

Correct Answer

Problems whose complements are in NP

Explanation

co-NP = {L̄ | L ∈ NP}: languages whose complement is in NP. If P = NP, then P = NP = co-NP. It is unknown if NP = co-NP. TAUTOLOGY is co-NP-complete.

19

What is the polynomial hierarchy?

B

Correct Answer

A hierarchy of complexity classes Σₖᴾ, Πₖᴾ generalizing NP and co-NP with alternating quantifiers

Explanation

PH = ∪ Σₖᴾ where Σ₀ᴾ = P, Σ₁ᴾ = NP, Π₁ᴾ = co-NP, Σ₂ᴾ = NP^NP, etc. If any level collapses (Σₖ = Πₖ), the entire hierarchy collapses.

20

What is a Mealy machine?

B

Correct Answer

A finite transducer producing output based on the current state and input symbol (output on transitions)

Explanation

Mealy machines produce output λ(q,a) for each transition. Moore machines produce output only based on state. Both are equivalent in expressive power.

21

What is the two-stack PDA and its expressive power?

B

Correct Answer

Equivalent to a Turing machine — recognizes all RE languages

Explanation

A PDA with two stacks is equivalent to a Turing machine. One stack simulates the left part of the tape and one the right part. This shows the power jump from one to two stacks.

22

What is a time-constructible function?

B

Correct Answer

A function f(n) for which a TM can write f(n) in unary on input 1ⁿ in O(f(n)) time

Explanation

Time-constructible functions are needed in the Time Hierarchy Theorem: DTIME(o(f(n)/log f(n))) ⊊ DTIME(f(n)) for time-constructible f, proving there are problems requiring more time.

23

What is the relationship between decidability and semi-decidability?

B

Correct Answer

Decidable implies semi-decidable (recognizable). A problem is decidable iff it and its complement are both semi-decidable

Explanation

If L and L̄ are both RE, then L is decidable. For a recognizer of L: run it and a recognizer of L̄ in parallel; whichever halts first decides. This is Turing's decidability characterization.

24

What is a 3-SAT problem?

B

Correct Answer

A satisfiability problem where each clause has exactly three literals — NP-complete and used in many reductions

Explanation

3-SAT is NP-complete (reduced from SAT). Every clause has exactly 3 literals. Many NP-completeness proofs reduce from 3-SAT, making it a fundamental problem in complexity theory.

25

What is the space complexity class L (LOGSPACE)?

B

Correct Answer

Problems decidable using O(log n) working space (not counting input)

Explanation

L = DSPACE(log n): problems solvable with O(log n) extra workspace. L ⊆ P. Graph reachability (STCON) is NL-complete (nondeterministic logspace). L vs NL is open.

26

What is the self-reference in Kleene's recursion theorem?

B

Correct Answer

Every Turing machine can obtain and manipulate its own description, enabling programs that print themselves (quines)

Explanation

Kleene's Recursion Theorem: for any TM T, there exists a TM R that, when run, behaves as T does when T receives R's description as input. Used to construct quines and prove results in computability.

27

What is an oracle Turing machine?

B

Correct Answer

A TM augmented with an oracle (black box) that answers queries about a fixed language in one step

Explanation

Oracle TMs are used to define relative complexity: Pᴬ means P with access to oracle A. Baker-Gill-Solovay showed there exist oracles A where Pᴬ = NPᴬ and oracles B where Pᴮ ≠ NPᴮ.

28

What is interactive proof system (IP class)?

B

Correct Answer

A computational model where a polynomial-time verifier interacts with an unbounded prover via randomized challenges

Explanation

IP = PSPACE (Shamir 1992). The prover convinces a verifier of a true statement through multiple rounds of interaction with randomized queries, with completeness and soundness properties.

29

What is zero-knowledge proof?

B

Correct Answer

A protocol where a prover convinces a verifier of a statement without revealing any information beyond the truth of the statement

Explanation

ZK proofs satisfy completeness (honest prover convinces verifier), soundness (dishonest prover fails), and zero-knowledge (verifier learns nothing except the statement is true). Used in cryptography.

30

What does the acronym EXPTIME mean?

A

Correct Answer

Problems solvable in time 2^O(n^k) for some k

Explanation

EXPTIME = DTIME(2^(n^k)) for constant k. P ⊆ NP ⊆ PSPACE ⊆ EXPTIME. It is known P ⊊ EXPTIME (Time Hierarchy). Go (game) is EXPTIME-complete.

31

How do you systematically convert a regular expression into an NFA?

B

Correct Answer

Using Thompson's construction, which builds small NFA fragments for each operator (union, concatenation, star) and combines them with ε-transitions

Explanation

Thompson's construction recursively builds NFA fragments for each regex sub-expression and joins them with ε-transitions, guaranteeing the resulting NFA has at most twice as many states as regex symbols.

32

How do you prove that the language L = {0ⁿ1ⁿ | n ≥ 0} is not regular?

B

Correct Answer

Assume L is regular, apply the Pumping Lemma with pumping length p, choose w = 0ᵖ1ᵖ, and show every valid split xyz produces a pumped string xy²z that is not in L

Explanation

The standard pumping argument picks w = 0ᵖ1ᵖ. Since |xy| ≤ p, the substring y consists only of 0s, so pumping (xy²z) creates more 0s than 1s, contradicting membership in L and proving L is not regular.

33

Which closure property distinguishes regular languages from context-free languages?

B

Correct Answer

Regular languages are closed under intersection and complement, while context-free languages are closed under neither in general

Explanation

Regular languages form a Boolean algebra — closed under union, intersection, and complement. Context-free languages are closed under union, concatenation, and star, but generally not under intersection or complement (e.g., the intersection of two CFLs can be non-context-free).

34

How would you construct a context-free grammar for the language {aⁱbʲ | i ≠ j}?

B

Correct Answer

A grammar built from the union of {aⁱbʲ | i > j} and {aⁱbʲ | i < j}, each generated using a "matching core" plus extra unmatched symbols on one side

Explanation

Because {aⁱbʲ | i ≠ j} is the union of "more a's than b's" and "more b's than a's," a CFG generates a balanced aⁿbⁿ core and then prepends extra a's or appends extra b's, illustrating how CFLs are built from simpler component languages.

35

Why is left recursion a problem for top-down (LL) parsers, and how is it resolved?

B

Correct Answer

A left-recursive rule like A → Aα | β causes infinite recursive descent without consuming input; it is eliminated by rewriting the grammar as A → βA' and A' → αA' | ε

Explanation

A predictive parser expanding A → Aα would call itself again before reading input, looping forever. The standard fix rewrites left recursion into right recursion using a fresh non-terminal, preserving the language while making top-down parsing feasible.

36

How is the product construction used to build a DFA for the intersection of two regular languages?

B

Correct Answer

By building a DFA whose states are pairs (q, r) — one state from each input DFA — that moves both components in lockstep and accepts only when both component states are accepting

Explanation

The product construction simulates two DFAs simultaneously: each state is a pair (q, r), transitions move both components on the same symbol, and a pair is accepting only if both q and r are accepting — directly proving regular languages are closed under intersection.

37

What technique converts a CFG into Chomsky Normal Form, and why is it useful?

B

Correct Answer

Eliminating ε-productions, unit productions, and useless symbols, then breaking long right-hand sides into binary productions — this regular structure enables efficient algorithms like CYK

Explanation

CNF conversion proceeds in stages — removing ε- and unit-productions, eliminating unreachable/non-generating symbols, then restructuring rules into A → BC or A → a form. This uniform binary structure is exactly what the CYK parsing algorithm requires.

38

Which of the following problems about finite automata is decidable?

B

Correct Answer

Whether two given DFAs recognize the same language (DFA equivalence)

Explanation

DFA equivalence is decidable: minimize both DFAs (or build a product DFA checking the symmetric difference) and compare; if no string is accepted by exactly one, they are equivalent. This contrasts sharply with the undecidable equivalence problem for Turing machines.

39

How does the subset construction explain why an n-state NFA can require up to 2ⁿ states when converted to a DFA?

B

Correct Answer

Because each DFA state represents a distinct subset of the NFA's state set, and there are 2ⁿ possible subsets of an n-element set, all of which may be reachable for some languages

Explanation

In the subset (powerset) construction, each DFA state is the set of NFA states reachable on a given input prefix. Since an n-element set has 2ⁿ subsets, certain NFAs (carefully designed) force all of them to be distinguishable, giving a tight exponential blow-up.

40

How can you show that context-free languages are closed under concatenation but not under intersection?

A

Correct Answer

Concatenation can combine any two grammars by relabeling symbols, while intersection has no analogous grammar-level construction; intersecting two CFLs (e.g., {aⁿbⁿcᵐ} and {aᵐbⁿcⁿ}) can yield {aⁿbⁿcⁿ}, which fails the CFL Pumping Lemma

Explanation

For concatenation, you build a new grammar S → S₁S₂ combining the two start symbols. No such simple construction exists for intersection — and the classic counterexample intersects two context-free languages to obtain {aⁿbⁿcⁿ}, which the CFL Pumping Lemma shows is not context-free.

1

What does the Time Hierarchy Theorem prove?

B

Correct Answer

For time-constructible f(n), DTIME(o(f(n)/log f(n))) ⊊ DTIME(f(n)) — more time strictly more power

Explanation

The Time Hierarchy Theorem proves that more time gives strictly more computational power. It implies P ⊊ EXPTIME and rules out collapsing of the complexity hierarchy.

2

What is the Immerman-Szelepcsényi theorem?

B

Correct Answer

NSPACE(f(n)) is closed under complement for all space-constructible f(n) ≥ log n, proving NL = co-NL

Explanation

Immerman and Szelepcsényi independently proved NL = co-NL (1987/1988) using inductive counting: the complement of graph reachability is in NL.

3

What is the significance of showing that a language is not context-free using the CFL Pumping Lemma?

B

Correct Answer

It proves the language requires at least a context-sensitive grammar or LBA, not just a CFG/PDA

Explanation

Proving a language violates the CFL Pumping Lemma shows it cannot be context-free. It must be context-sensitive, recursively enumerable, or non-RE, depending on what TM variant can recognize it.

4

What is Ladner's theorem and what does it imply?

B

Correct Answer

If P ≠ NP, there exist NP-intermediate problems — in NP but neither in P nor NP-complete

Explanation

Ladner's theorem (1975) proves: if P ≠ NP, the NP class is not just P and NP-complete — there are problems "in between." Graph Isomorphism is suspected to be NP-intermediate.

5

What is an oblivious Turing machine and why is it important for complexity?

B

Correct Answer

A TM whose head movement depends only on the step number and input length (not content), useful for proving simulation theorems with constant overhead

Explanation

Oblivious TMs can be simulated by circuits and are used in proofs relating time complexity to circuit complexity (e.g., NC, P/poly). Any TM can be made oblivious with O(T log T) slowdown.

6

What is descriptive complexity theory?

B

Correct Answer

Characterizing complexity classes by the logical languages that define them (e.g., P = FO + LFP on ordered structures)

Explanation

Descriptive complexity (Fagin, Immerman) connects logic and complexity: NP = ∃SO (existential second-order logic), P = FO+LFP on ordered structures, L = FO+DTC. This gives machine-independent characterizations.

7

What is the Karp-Lipton theorem?

B

Correct Answer

If NP ⊆ P/poly (polynomial-size circuits), then the polynomial hierarchy collapses to the second level (PH = Σ₂ᴾ)

Explanation

Karp-Lipton (1980): NP ⊆ P/poly → PH collapses. This is evidence against NP ⊆ P/poly, since most believe PH doesn't collapse. It connects circuit complexity to the P vs NP question.

8

What is Arthur-Merlin protocol (AM class)?

B

Correct Answer

An interactive proof system where Arthur (verifier) sends random coins publicly and Merlin (prover) responds; AM = IP with public coins

Explanation

AM protocols use public randomness (Arthur's coins visible to Merlin). AM = IP[O(1)] = NP^RP. Goldwasser-Sipser showed AM ⊆ IP. AM is believed to equal NP.

9

What is the connection between Boolean circuits and uniform complexity classes?

B

Correct Answer

P/poly is the class of languages decidable by polynomial-size (non-uniform) circuits; P corresponds to uniform circuit families generated in logspace

Explanation

A language is in P/poly iff it has polynomial-size circuit families (non-uniform). Uniformity (logspace-uniform) restricts to P. NC ⊆ P corresponds to shallow, parallel circuits.

10

What is the Razborov-Smolensky theorem?

B

Correct Answer

Proving super-polynomial lower bounds on the size of constant-depth AC⁰[p] circuits computing MOD-q for prime p ≠ q

Explanation

Razborov showed MOD-2 is not in AC⁰[3]; Smolensky extended this to all primes. This is one of the deepest circuit lower bounds, proving strict separations in the circuit complexity hierarchy.

11

What is the Toda's theorem in complexity theory?

B

Correct Answer

The polynomial hierarchy PH is contained in P^#P — a single call to a #P oracle suffices to solve any problem in PH

Explanation

Toda's theorem (1991): PH ⊆ P^#P. This means any level of the polynomial hierarchy can be solved with one query to a counting oracle, showing counting is surprisingly powerful.

12

What is the #P complexity class?

A

Correct Answer

The class of counting problems for NP — counting the number of accepting paths of an NTM

Explanation

#P counts the number of accepting paths of a polynomial-time NTM. Counting the number of satisfying assignments of a Boolean formula is #P-complete (#SAT). #P is at least as hard as NP.

13

What is the relationship between NL and co-NL?

B

Correct Answer

NL = co-NL by Immerman-Szelepcsényi theorem

Explanation

Immerman and Szelepcsényi (1987-88) proved independently that nondeterministic logspace is closed under complement: NL = co-NL. This was surprising given analogous questions at higher levels remain open.

14

What is the Baker-Gill-Solovay result about oracles?

B

Correct Answer

There exist oracles A and B such that Pᴬ = NPᴬ and Pᴮ ≠ NPᴮ — the P vs NP question cannot be resolved by relativizing proof techniques

Explanation

BGS (1975) showed P vs NP is immune to relativization: some oracles collapse P = NP, others separate them. This rules out many standard proof techniques for resolving P vs NP.

15

What is the PCP theorem?

B

Correct Answer

NP = PCP(log n, O(1)) — every NP language has a probabilistically checkable proof using O(log n) random bits and O(1) query bits

Explanation

The PCP Theorem (1992) states NP = PCP(log n, 1). Its main consequence: approximating many NP-hard optimization problems is itself NP-hard, establishing approximation hardness results.

16

What is derandomization and its connection to circuit lower bounds?

B

Correct Answer

Removing randomness from probabilistic algorithms; Nisan-Wigderson showed hard functions imply pseudorandom generators, connecting lower bounds to P = BPP

Explanation

Nisan-Wigderson (1994): if there exist functions hard for exponential-size circuits, then P = BPP (all randomized polynomial algorithms can be derandomized). Strong lower bounds → BPP = P.

17

What is the complexity class BPP?

B

Correct Answer

Bounded-error Probabilistic Polynomial time: problems solvable by a probabilistic TM in polynomial time with error probability ≤ 1/3

Explanation

BPP allows at most 1/3 error probability on any input. P ⊆ BPP ⊆ PSPACE. It is widely believed BPP = P (derandomization conjecture), though unproven.

18

What is a universal Turing machine?

B

Correct Answer

A TM that takes as input the encoding of another TM M and an input w, and simulates M on w

Explanation

The UTM (Universal Turing Machine) is a single machine that simulates any other TM given its description. It formalizes the concept of a stored-program computer and is central to undecidability proofs.

19

What is the connection between NP-hardness and approximation algorithms?

B

Correct Answer

The PCP theorem implies inapproximability results: some NP-hard problems are hard to approximate within certain factors unless P = NP

Explanation

PCP theorem implies: MAX-3-SAT is NP-hard to approximate within 7/8+ε; Clique within n^(1-ε); Vertex Cover within some constant. Some NP-hard problems do have PTAS (e.g., Euclidean TSP).

20

What does the Space Hierarchy Theorem establish, and how does it differ from the Time Hierarchy Theorem?

D

Correct Answer

For space-constructible f(n), it proves DSPACE(o(f(n))) ⊊ DSPACE(f(n)) — a strictly tighter separation than the Time Hierarchy Theorem because space can be reused, removing the log-factor overhead needed for diagonalization in time

Explanation

The Space Hierarchy Theorem gives DSPACE(o(f(n))) ⊊ DSPACE(f(n)) for space-constructible f, a cleaner separation than the Time Hierarchy Theorem's DTIME(o(f(n)/log f(n))) ⊊ DTIME(f(n)). The gap is tighter because a diagonalizing machine can reuse space when simulating other machines, avoiding the bookkeeping overhead that costs a log factor in the time-based argument.