Compilers Mcqs on “Right Left Linear Grammar”.
1. Left Linear grammar can be converted to Right Linear grammar.
a) Yes
b) No
Answer: a
Clarification: Since right-linear grammars are regular, it follows that left-linear grammars are also regular.
2. What is CFG?
a) Compiler
b) A language expression
c) Regular Expression
d) None of the mentioned
Answer: b
Clarification: They are defined by rule A->b where A is non terminal and b is terminal.
3. What is the idea of automation with a stack as auxiliary storage?
a) Finite automata
b) Push Down Automata
c) Deterministic Automata
d) None of the mentioned
Answer: b
Clarification: Push Down Automata manipulate the Stack as a part of performing a transition.
4. Transition of finite automata is ___________
a) Finite Diagram
b) State Diagram
c) Node Diagram
d) E-R Diagram
Answer: b
Clarification: Transition of finite automata is Finite Diagram.
5. A context free language is called ambiguous if?
a) It has 2 or more than 2 left derivations for some terminal string ѡ є L (G)
b) It has 2 or more than 2 right derivations for some terminal string ѡ є L (G)
c) It has 2 or more than 2 left and right derivations for some terminal string ѡ є L (G)
d) None of the mentioned
Answer: c
Clarification: When two or more Left and right most derivative occur the grammar turn ambiguous .
6. Which of the following statement is true?
a) Every language that is defined by regular expression can also be defined by finite automata
b) Every language defined by finite automata can also be defined by regular expression
c) We can convert regular expressions into finite automata
d) All of the mentioned
Answer: d
Clarification: All these statements are true w.r.t regular expression.
7. Which of the following identity is wrong?
a) R + R = R
b) (R*)* = R*
c) ƐR = Rɛ = R
d) ØR = RØ = RR*
Answer: d
Clarification: Regular grammar combined with empty does not give R* instead gives empty.
8. Grammars that can be translated to DFAs is __________
a) Left linear grammar
b) Right linear grammar
c) Generic grammar
d) All of the mentioned
Answer: b
Clarification: Right Linear grammar can be translate to DFA.
9. A language is regular if and only if it is accepted by finite automata.
a) The given statement statement is true
b) Given statement is false
c) Statement is partially true
d) None of the mentioned
Answer: a
Clarification: Regular Language is accepted by Finite Automata. Every regular language is Context free.
10. A Push Down Automata is if there is at most one transition applicable to each configuration?
a) Deterministic
b) Non deterministic
c) Finite
d) Non finite
Answer: a
Clarification: In every situation, only one transition is available as continuation then the result is deterministic push down automata.