Compilers Questions and Answers – Right Left Linear Grammar – 2

«
»

This set of Compilers Mcqs focuses on “Right Left Linear Grammar – 2”.

1. Left Linear grammar can be converted to Right Linear grammar.
a) Yes
b) No
View Answer

Answer: a
Explanation: Since right-linear grammars are regular, it follows that left-linear grammars are also regular.
advertisement

2. What is CFG?
a) Compiler
b) A language expression
c) Regular Expression
d) None of the mentioned
View Answer

Answer: b
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: c
Explanation: When two or more Left and right most derivative occur the grammar turn ambiguous .
advertisement

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
View Answer

Answer: d
Explanation: 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*
View Answer

Answer: d
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: a
Explanation: Regular Language is accepted by Finite Automata. Every regular language is Context free.
advertisement

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
View Answer

Answer: a
Explanation: In every situation, only one transition is available as continuation then the result is deterministic push down automata.

Sanfoundry Global Education & Learning Series – Compilers.

To practice MCQs on all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn