Parsing Techniques - LL/LR

Download Q&A
Q. In an LR parser, what is the purpose of the 'shift' action?
  • A. To reduce a production.
  • B. To push a state onto the stack.
  • C. To pop a state from the stack.
  • D. To accept the input.
Q. In LR parsing, what is the significance of the 'shift' action?
  • A. To reduce the current production.
  • B. To move the input pointer to the next token.
  • C. To add a new production to the parse tree.
  • D. To backtrack to a previous state.
Q. In the context of LL parsing, what does the '1' in LL(1) signify?
  • A. One lookahead token is used.
  • B. One leftmost derivation is produced.
  • C. One parsing table is required.
  • D. One recursive call is made.
Q. What does LR stand for in LR parsing?
  • A. Left-to-right
  • B. Right-to-left
  • C. Left-to-right with lookahead
  • D. Right-to-left with lookahead
Q. What does the 'reduce' action do in an LR parser?
  • A. It shifts the next input symbol onto the stack.
  • B. It pops symbols from the stack and replaces them with a non-terminal.
  • C. It accepts the input string.
  • D. It generates an error.
Q. What is a common limitation of LL parsers?
  • A. They cannot handle ambiguous grammars.
  • B. They require more memory than LR parsers.
  • C. They can only parse regular languages.
  • D. They are slower than LR parsers.
Q. What is the main characteristic of LL parsing?
  • A. It uses a top-down approach.
  • B. It uses a bottom-up approach.
  • C. It requires left recursion.
  • D. It is non-deterministic.
Q. What is the primary advantage of using LR parsing over LL parsing?
  • A. Simplicity of implementation.
  • B. Ability to handle left recursion.
  • C. Lower memory usage.
  • D. Faster parsing speed.
Q. What is the primary purpose of a parsing table in LR parsing?
  • A. To store the grammar rules.
  • B. To determine the next action based on the current state and input symbol.
  • C. To keep track of the parse tree.
  • D. To optimize the parsing process.
Q. What is the role of the parsing table in an LR parser?
  • A. To store the grammar rules.
  • B. To determine the next action based on the current state and input symbol.
  • C. To keep track of the parse tree.
  • D. To manage memory allocation.
Q. Which of the following grammars can be parsed using LL(1) parsing?
  • A. Left-recursive grammars
  • B. Ambiguous grammars
  • C. Non-left-recursive and unambiguous grammars
  • D. Context-free grammars only
Q. Which of the following is a key advantage of LR parsing over LL parsing?
  • A. LR parsing can handle left recursion.
  • B. LR parsing is simpler to implement.
  • C. LL parsing can handle more complex grammars.
  • D. LR parsing requires less memory.
Q. Which of the following is a requirement for an LL(1) parser?
  • A. The grammar must be left recursive.
  • B. The grammar must be ambiguous.
  • C. The grammar must be free of left recursion.
  • D. The grammar must have multiple left factors.
Q. Which of the following is NOT a type of LR parser?
  • A. SLR
  • B. LALR
  • C. LR(1)
  • D. LL(1)
Q. Which of the following is true about SLR parsing?
  • A. It uses a single lookahead token.
  • B. It is a type of LL parsing.
  • C. It can handle all context-free grammars.
  • D. It is less powerful than canonical LR parsing.
Q. Which of the following parsing techniques can handle a larger class of grammars?
  • A. LL parsing
  • B. LR parsing
  • C. Recursive descent parsing
  • D. Predictive parsing
Q. Which of the following statements is true about LL and LR parsers?
  • A. LL parsers are more powerful than LR parsers.
  • B. LR parsers can handle all LL grammars.
  • C. LL parsers can handle all LR grammars.
  • D. Both LL and LR parsers are equivalent in power.
Q. Which parsing technique is generally more powerful, LL or LR?
  • A. LL
  • B. LR
  • C. Both are equally powerful.
  • D. Neither is powerful.
Showing 1 to 18 of 18 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely