MCQ Bank
Compare the size of parsing tables generated by an original grammar and an augmented grammar;
- A) The size of the parsing table is smaller for the original grammar.
- B) The size of the parsing table is the same for both grammars.
- C) The size of the parsing table is larger for the original grammar.
- D) The size of the parsing table is larger for the augmented grammar.
Which of the following is NOT a step in the closure procedure for an LR item?
- A) Identify the symbols immediately following the dot in the item.
- B) Compute the FIRST set for the nonterminal symbol following the dot.
- C) Determine the lookahead symbols for the item.
- D) Add the item to the closure set.
In the reduce action, the shift-reduce parser applies an inverse production at the right end of the ________________ string.
- A) Left
- B) Right
- C) Bottom
- D) Top
In the context of Shift-Reduce parser, the number of complete handles is equal to the number of ____________.
- A) Terminals
- B) Symbols
- C) Non-terminals
- D) Productions
The purpose of the added ε-transitions in the NFA is to:
- A) Resolve conflicts in the parsing process.
- B) Recognize the symbols β before a reduction by X → β.
- C) Identify the start state of the grammar.
- D) Push the non-terminal X onto the parse stack.
In LR grammar, the L stands for ________________.
- A) Left to right scan
- B) Left hand side of grammar
- C) Left most derivation
- D) Left Shift
This initial state signifies the starting point of the parsing process and serves as the entry point for constructing the LR table.
- A) True
- B) False
- C)
- D)
In the grammar "A → a d c b | a d b c", the ____________ is a common prefix for non-terminal 'A'.
- A) b
- B) d c b
- C) a d
- D) a b c d
If X is a non-terminal symbol, the transition on symbol X in the NFA of LR(0) items corresponds to:
- A) Shifting X from the parse stack to the input.
- B) Applying the closure operation to the LR(0) items.
- C) Determining the valid lookahead symbols.
- D) Performing a reduction based on the production rule X → γ.
What is the purpose of the augmented start production in the augmented grammar?
- A) It ensures that the grammar meets the requirements of parsing algorithms.
- B) It indicates the end of the input for parsing purposes.
- C) It represents the first production rule in the grammar.
- D) It introduces a new non-terminal symbol in the grammar.
A top-bottom parser operates by repeatedly locating handles on the frontier of the partial parse tree and performing reductions that they specify.
- A) False
- B) True
- C)
- D)
For every LR(0) item "A → α•Xη", the ε-transitions are added for:
- A) The terminal symbols in the input sequence.
- B) The lookahead symbols of X.
- C) The non-terminal symbols in the grammar.
- D) The production rules containing X as a non-terminal.
In the context of LR(1) parser, the construction of _______________ begins by building a model of parser’s initial state.
- A) Handle
- B) Canonical Collection
- C) Upper Frontier
- D) Closure Procedure
In the handle representation <A → α, k>, where A is the left-hand side non-terminal and α is the right-hand side, what does α represent?
- A) The entire input string.
- B) The stack symbols of the parser.
- C) The input symbols matched by the handle.
- D) The handle itself.
The action table in the DFA representation table is used for:
- A) Shifting terminals
- B) Transitioning to non-terminals
- C) Accepting the input
- D) Reducing using production rules
In the LR item [S' → •S, $], the "S" represents a non-terminal symbol in the grammar.
- A) True
- B) False
- C)
- D)
The augmented grammar has its own start symbol, while original grammar includes an additional production rule, called the augmented start production.
- A) True
- B) False
- C)
- D)
Which of the following is NOT a step in the closure procedure for an LR item?
- A) Add the item to the closure set.
- B) Determine the lookahead symbols for the item.
- C) Identify the symbols immediately following the dot in the item.
- D) Compute the FIRST set for the nonterminal symbol following the dot.
For the grammar "S → a c T | a U", it is very easy to predict because two productions start with 'a'.
- A) False
- B) True
- C)
- D)
If find ε in FIRST(α), add production rule "A → α" to LL(1) parsing table entry M[A, b] for each ____________ in FOLLOW(A).
- A) Non-Terminal B
- B) Terminal a
- C) Terminal b
- D) Non-Terminal A