Which of the following statements about token recognition using finite…

2025

Which of the following statements about token recognition using finite automata is true?

  1. A.

    Finite Automata are not suitable for recognizing operators in source code.

  2. B.

    Lexical analyzers require context-sensitive grammars for accurate token recognition.

  3. C.

    Every token defined by a regular expression can be recognized by a Deterministic Finite Automaton (DFA).

  4. D.

    Only Nondeterministic Finite Automata (NFA) can be used to recognize tokens in a compiler.

Attempted by 42 students.

Show answer & explanation

Correct answer: C

In formal language theory, any language defined by a regular expression is a regular language. Kleene's Theorem proves that every regular language can be recognized by both Non-deterministic Finite Automata (NFA) and Deterministic Finite Automata (DFA). Since NFAs can always be converted into equivalent DFAs via subset construction, lexical analyzers (like Lex or Flex) convert token-defining regular expressions into efficient DFAs to scan source code at runtime.

Explore the full course: Niacl Ao It Specialist