250+ TOP MCQs on Right Left Linear Grammar and Answers

Compilers Multiple Choice Questions & Answers (MCQs) on “Right Left Linear Grammar”.

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

Answer: a
Clarification: 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

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

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

Answer: a
Clarification: 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

Answer: a
Clarification: Right-Linear grammars, following are the form of productions: A → xB or A → x where x is some string of terminals.

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

Answer: a
Clarification: 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.

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

Answer: d
Clarification: 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

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

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

Answer: b
Clarification: 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

Answer: a
Clarification: 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

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

Leave a Reply

Your email address will not be published. Required fields are marked *