Following questions have been asked in GATE CS 2011 exam.
1) The lexical analysis for a modern language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
(A) Finite state automata
(B) Deterministic pushdown automata
(C) Non-deterministic pushdown automata
(D) Turing machine
Lexical analysis is the first step in compilation. In lexical analysis, program is divided into tokens. Lexical analyzers are typically based on finite state automata. Tokens can typically be expressed as different regular expressions:
An identifier is given by [a-zA-Z][a-zA-Z0-9]*
The keyword if is given by if.
Integers are given by [+-]?[0-9]+.
2) Which of the following pairs have DIFFERENT expressive power?
(A) Deterministic finite automata (DFA) and Non-Deterministic finite automata(NFA)
(B) Deterministic push down automata (DPDA) and Non-deterministic pushdown automata
(C) Deterministic single-tape Turing machine and Non-deterministic single-tape Turing Machine
(D) Single-tape Turing machine and multi-tape Turing machine
DPDA cannot handle languages or grammars with ambiguity, but NDPDA can handle languages with ambiguity and any context-free grammar.
Options (B) and (C) are invalid because they both accept ‘b’ as a string which is not accepted by give DFA. D is invalid because it accepts bb+a which are not accepted by given DFA.
Please see GATE Corner for all previous year paper/solutions/explanations, syllabus, important dates, notes, etc.
Please write comments if you find any of the answers/explanations incorrect, or you want to share more information about the topics discussed above.
- Automata Theory | Set 1
- Automata Theory | Set 2
- Automata Theory | Set 4
- Automata Theory | Set 6
- Automata Theory | Set 5
- Automata Theory | Set 7
- Automata Theory | Set 8
- Automata Theory | Set 9
- Automata Theory | Set 10
- Difference between Pushdown Automata and Finite Automata
- Mathematics | Set Operations (Set theory)
- Designing Finite Automata from Regular Expression (Set 1)
- Designing Non-Deterministic Finite Automata (Set 3)
- Practice problems on finite automata | Set 2
- Designing Deterministic Finite Automata (Set 1)
- Designing Deterministic Finite Automata (Set 2)
- Designing Finite Automata from Regular Expression (Set 6)
- Finite Automata with Output (Set 6)
- Finite Automata with Output (Set 5)
- Designing Deterministic Finite Automata (Set 3)