Finite State Machines, automatons and regexes
![]() |
![]() |
![]() |
Title of test:![]() Finite State Machines, automatons and regexes Description: finite state machines and some bonus content |




New Comment |
---|
NO RECORDS |
Let the alphabet be sigma symbol = {a, b} and the regular language L = { ω | ω ∈ Σ * and the number of a’s in ω is even}. Which of the regular expressions below generates this language?. A) (a b* a b*)*. B) ( ( a a )* | b* )*. C) ( b* | ( a a )* | b* )*. D) ( b* a b* a b* )*. E) ( a a | b )*. Consider the following nondeterministic finite automaton, where A is the initial state and D is the only accepting state. What deterministic finite automaton with d as its state transition function accepts the same language?. A) Initial state A, accepting states C and D d(A, b) = B d(B, a) = C d(C, a) = D. B) Initial state A, accepting state C d(A, b) = B d(B, a) = C d(C, a) = C. C) Initial state A, accepting state D d(A, b) = B d(B, a) = D d(B, b) = C d(C, a) = D. D) All of the above answers are correct. E) It is impossible to convert this nondeterministic finite automaton into a deterministic finite automaton. Lexical analysis is usually implemented using: hint: Lexical analysis, which is the first phase of a compiler, typically uses regular grammar (or regular expressions) to describe the lexical structure of tokens (such as keywords, identifiers, operators, etc.). A) Regular grammar. B) Context-free grammar. C) Context-sensitive grammar. D) Unrestricted grammar. E) Stack grammar. What is the grammar language with the following production rules? S -> ASb | c A -> a remember: S is a nonterminal placeholder, meaning a starting string. with A->a, we know that it should start with an 'a'. ASb means that b will be added as a string each time the rule is applied, whereas c is only used once............ A) { a^ncb | n ∈N }. B) { acb^n | n ∈N }. C) { a^nc^nb | n ∈N }. D) { a^ncb^n | n ∈N }. E) None of the above. Consider a production belonging to a grammar G given by: L -> L to S | S Select the alternative below that, replacing this production, eliminates the recursion to the left, creating an equivalent grammar: a. b. c. d. e. A compiler is checking whether a variable has been declared only once, whether it has been declared before its first use, whether it has been declared and never used, and whether the data types in an arithmetic expression are compatible. These checks are performed in the. a- syntactic analysis. B- code generation. C- lexical analysis. D-semantic analysis. E- code optimization. |