Compilers Questions and Answers – Right Left Linear Grammar – 1

This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Right Left Linear Grammar – 1”.

1. Non-Linear grammar has two non-terminals on the right-hand side.
a) True
b) False
View Answer

Answer: a
Explanation: The above stated grammar is non-linear because it has two non-terminals on the right-hand side.

2. Which type of grammar is it?

S → SS S → λ S → aSb S → bSa

a) Linear
b) Nonlinear
c) Linear & Nonlinear
d) None of the mentioned
View Answer

Answer: a
Explanation: Grammar is non-linear because one of the rules (the first one) has two non-terminals on the right-hand side.
advertisement
advertisement

3. Linear grammar has more than one non-terminal on the right-hand side.
a) True
b) False
View Answer

Answer: a
Explanation: Grammar is linear because no rule has more than one non terminal on the right-hand side.

4. In Right-Linear grammars, all productions have the form: A → xB.
a) True
b) False
View Answer

Answer: a
Explanation: Right-Linear grammars, following are the form of productions: A → xB or A → x where x is some string of terminals.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

5. Which type of grammar is it?

S → abS S → a

a) Right Linear Grammar
b) Left Linear Grammar
c) Right & Left Linear Grammar
d) None of the mentioned
View Answer

Answer: a
Explanation: grammars in which all of the rules contain only one non-terminal on the left-hand side, and where in every case that non-terminal is the first symbol are called right Linear.
advertisement

6. What are the two types of Linear Grammar?
a) Right Linear
b) Left Linear
c) None of the mentioned
d) Right & Left Linear
View Answer

Answer: d
Explanation: Linear grammar is of 2 types Left and Right Linear Grammar

7. Which Grammar is it?
a) Right Linear
b) Left Linear
c) None of the mentioned
d) Right & Left Linear
View Answer

Answer: b
Explanation: In Left-Linear grammars, all productions have the form: A→Bx or A→ x where x is some string of terminals.
advertisement

8. Which Type of Grammar is it?

S → Aa A → Aab | λ

a) Right Linear
b) Left Linear
c) None of the mentioned
d) Right & Left Linear
View Answer

Answer: b
Explanation: In this case they both correspond to the regular expression (ab)*a.

9. A Regular Grammar is any right-linear or left-linear grammar.
a) True
b) False
View Answer

Answer: a
Explanation: As it turns out the languages that can be generated by Regular Grammars is equivalent to those that can be specified by Regular Expressions.

10. Regular Grammars generate Regular Languages.
a) True
b) False
View Answer

Answer: a
Explanation: That’s why they are called regular languages.

Sanfoundry Global Education & Learning Series – Compilers.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.