Compiler Construction MCQ :Syntax Analysis(Parser)-Operator Precedence Parser, LR parser : Link6

Compiler Construction MCQ :Syntax Analysis(Parser)-Operator Precedence Parser, LR parser : Link6

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Syntax Analysis(Parser)-Operator Precedence Parser, LR parser? We have arranged the Show Answer button under the each question. Candidates can click on it to know the right option among the given alternatives. Furthermore, the applicants can check our web portal @ www.totalmcq.com to take part in more MCQ on various subject. Wish, the given information about the Compiler Construction MCQ will helpful to the advance and can learn the various types of questions and answers.


Q.1. LR parser is attractive because--------------

A. It can be constructed to recognize CFG corresponding to almost all programming constructs.
B. It does not backtrack
C. It detects error as and when they occur
D. Both A and B

Q.2. Choose the correct statements.

A. There are CFG’s that are not LR
B. An ambiguous grammar can never be LR
C. An ambiguous grammar can be LR
D. Both A and B

Q.3. YACC builds up----------

A. SLR parsing table                                         B. canonical LR parsing table
C. LALR parsing table                                      D. None of the above

Q.4. Choose the incorrect statement.

A. LL(k) grammar has to be a CFG
B. LL(k) grammar has to be unambiguous
C. There are LL(k) grammars that are not context free
D. LL(k) grammars cannot have left recursive non-terminals

Q.5. LR(k) grammar-----

A. Can only examine a maximum of k input symbols
B. Can be used to identify handles and Covers the LL(k) class
C. Can be used to identify the production associated with a handle
D. All of the above.

Q.6. The ‘k’ in LR(k) cannot be------

A. 0                                                                     B. 1
C. 2                                                                     D. None of the above.

Q.7. Consider the grammar
E➔TE'
E'➔+TE'|ε
T➔FT'
T'➔*FT'|ε
F➔(E)|id
FOLLOW(F) will be--------

A. { +, *, ), $ }                                                     B. {+, ), $ }
C. {*, ), $}                                                           D. {+, (, ), * }

Q.8. LR(0) items of Production A➔ε is--------

A] A➔ε                                                               B] A➔.
C] A➔.ε                                                              D] A➔ε.

Q.9. To construct the canonical LR(0) collection for a grammar, we need to define an augmented grammar for G and two functions----and --------.

A. CLOSUREC, GOTO                                      B. SHIFT, REDUCE
C. SHIFT, SHIFT                                                D. None of the above.

Q.10. Construct LR(0) items for the following production
A➔ XYZ

A] A➔.XYZ
A➔X.YZ
A➔XY.Z
A➔XYZ.
B] A➔.XYZ
A➔X.YZ
A➔XYZ.
C] A➔.XYZ
A➔X.YZ
A➔XYZ.
D. None of the above.

Q.11. Check whether the following grammar is SLR(1) or not.
S➔A|B
A➔aA|b
B➔dB|b

A. SLR(1)                                                                B. not SLR(1)
C. CLR                                                                   D. None of the above.

Q.12. Consider the grammar
A -> B C C
B -> h B | ε
C -> C g | g | C h | i
D -> A B | ε
First of A is------

A] h, g, i                                                                B] g
C] h                                                                      D] None of the above.

Q.13. Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states. The relationship between n1 and n2 is------

A. n1 is necessarily less than n2                              B. n1 is necessarily equal to n2
C. n1 is necessarily greater than n2                        D. None of the above

Q.14. Which of the following statements is true?

A. SLR parser is more powerful than LALR
B. LALR parser is more powerful than Canonical LR parser
C. Canonical LR parser is more powerful than LALR parser
D. The parsers SLR, Canonical CR, and LALR have the same power

Q.15. Merging states with a common core may produce--------, conflicts but does not produce--------conflicts in an LALR parser.

A. reduce-reduce; shift-reduce                              B. shift-reduce; reduce-reduce
C. shift-reduce; shift-reduce                                  D. None of the above