MCQ Bank
In an LR(1) parser, does the Accept action consume any input?
- A) Yes
- B) No
- C)
- D)
In an LR(1) parser, Reduce action does not consume the input, while shift action advances the input by consuming the current token.
- A) False
- B) True
- C)
- D)
The canonical collection is constructed by repeatedly applying which operations?
- A) Closure and goto
- B) Reduce and goto
- C) Closure and shift
- D) Shift and reduce
In the handle representation <A → α, k>, what does A represent?
- A) The lookahead symbol.
- B) The position of the handle within the input string.
- C) The last symbol in the input string.
- D) The non-terminal on the left-hand side of the production rule.
The LR table is typically represented as a _______________ table.
- A) Four-dimensional
- B) Three-dimensional
- C) One-dimensional
- D) Two-dimensional
If find ε in FIRST(α), add production rule "A → α" to LL(1) parsing table entry M[A, b] for each ____________ in FOLLOW(A).
- A) Terminal a
- B) Terminal b
- C) Non-Terminal B
- D) Non-Terminal A
When transitioning from "A → α•Xη" to "A → αX•η" in the NFA of LR(0) items, the symbol X is a/an ____________ symbol.
- A) Lookahead
- B) Terminal
- C) Start
- D) Non-terminal
For each ____________, add production rule "A → α" to LL(1) parsing table entry M[A, a].
- A) Non-terminal 'A' in FIRST(α).
- B) Non-terminal 'A' in FOLLOW(α).
- C) Terminal 'a' in FIRST(α).
- D) Terminal 'a' in FOLLOW(α).
What does the GoTo table in the DFA representation table represent?
- A) Accepting the input
- B) Applying production rules
- C) Transitioning to non-terminals
- D) Transitioning to terminals
The identification of a handle in shift-reduce parsing is an indication that:
- A) A reduction can be performed.
- B) The next token needs to be shifted.
- C) A syntax error has occurred.
- D) The parsing process is complete.
If find ε in FIRST(α), the production rule "A → α" should be added to the LL(1) parsing table entry M[A, b] for each terminal 'b' in:
- A) FIRST(A)
- B) FOLLOW(A)
- C) FOLLOW(B)
- D) FIRST(B)
If FIRST(α) = {ε} and ____________, then add production rule "A → α" to LL(1) parsing table entry M[A, $].
- A) FOLLOW(α) = {ε}
- B) FOLLOW(α) = {a}
- C) FOLLOW(α) = {$}
- D) FOLLOW(α) = {A}
What does the marking of an entry in the LR table as "error" indicate?
- A) A reduction operation is to be performed
- B) An error has occurred in the parsing process
- C) A shift operation is to be performed
- D) The entry is unreachable in the LR automaton
In LR parsing, the error action indicates that the input has been successfully parsed, and the parsing process can be completed.
- A) True
- B) False
- C)
- D)
In an LR(1) parser, does the Error action consume any input?
- A) Yes
- B) No
- C)
- D)
At the start of LR(1) parser, a dummy symbol is pushed on stack "stack.push(dummy)". The purpose of it is;
- A) To assist in error recovery when encountering unexpected tokens.
- B) To prevent stack underflow during reduction operations.
- C) To handle conflicts in the parsing tables.
- D) To indicate the end of the parsing process.
In Shift-Reduce parsing, the process of identifying and reducing handles is essential for determining the validity of a given input string according to the given grammar.
- A) True
- B) False
- C)
- D)
The LR(1) items are used as the states of a finite automaton (FA) that maintains information about the parsing stack and progress of a/an ____________ parser.
- A) LL(1)
- B) RR(1)
- C) Top-down
- D) Shift-reduce
Both the original grammar and augmented grammar define the same language or set of valid strings.
- A) False
- B) True
- C)
- D)
The Upper Frontier is associated with which type of parsing algorithm?
- A) Bottom-Down
- B) Top-Up
- C) Top-Down
- D) Bottom-Up