MCQ'S
MCQ'S
b. Derivation of CFG
Q4: Which derivation generates a string step by step from leftmost non-terminal?
a) Leftmost derivation
b) Rightmost derivation
c) Ambiguous derivation
d) Precedence derivation
Answer: a) Leftmost derivation
c. Ambiguity in CFG
Q7: In the expression a+b×ca + b \times c, which operator is evaluated first if no parentheses are
given?
a) +
b) *
c) Both simultaneously
d) Depends on grammar
Answer: b) *
e. Recursion in CFG
Q9: What type of recursion occurs when a non-terminal appears on the leftmost side of its
production?
a) Right recursion
b) Indirect recursion
c) Left recursion
d) None of the above
Answer: c) Left recursion
Q11: Which of the following is the correct way to eliminate left recursion?
a) Remove the recursive rule entirely
b) Rewrite the grammar using new non-terminals
c) Use ambiguous grammar
d) None of the above
Answer: b) Rewrite the grammar using new non-terminals
2. Parsing
a. Introduction to Parsers
b. Types of Parsers
Q14: Which parser starts with the input symbols and works backwards to derive the start
symbol?
a) Top-down parser
b) Bottom-up parser
c) Recursive descent parser
d) Predictive parser
Answer: b) Bottom-up parser
c. Backtracking Problem in Top-Down Parser
d. Non-Determinism Problem
f. Predictive Parser
Let me know if you need further elaboration on any question or additional MCQs!