Compiler Construction MCQ :Syntax Analysis(Parser)-Left Recursion, Left factoring, LL(1) : Link2

Compiler Construction MCQ :Syntax Analysis(Parser)-Left Recursion, Left factoring, LL(1) : Link2

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Left Recursion, Left factoring, LL(1)? 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. Which of the following statements is false?.

A. An LL(1) parser is a top-down parser
B. An unambiguous grammar has same leftmost and rightmost derivation
C. LALR is more powerful than SLR
D. An ambiguous grammar can never be LR(k) for any k

Q.2. Consider the CFG with { S, A, B } as the non-terminal alphabet, { a, b } as the terminal alphabet, S as the start symbol and the following set of production rules:
S→bA     S→aB     A→a     B→b     A→aS     B→bS    S→bAA    B→aBB
Which of the following strings is generated by the grammar?

A. Aabbab                                                                  B. aabbbb
C. aaaabb                                                                  D. abbbba

Q.3. The left factored grammar for the following grammar is---------
A→∝β1|∝β2

A] A→∝A'
A'→β1|β2
B] A→∝A'|∈
A'→β1|β2
C] A→∝A'
A'→β1|β2|∈
D] None of the above.

Q.4. ----------grammar can have more than one parse tree generating a given string of a terminals.

A. Ambiguous                                                           B. Context free
C. Context sensitive                                                D. Unambiguous

Q.5. The grammar S→aSa|bS|c is-------

A. LL(1) but not LR(1)                                                B. LR(1) but not LL(1)
C. Both LL(1) and LR(1)                                             D. Neither LL(1) nor LR(1)

Q.6. Which of the following is not example of Top-Down Parser

A. Recursive Descent Parser                           B. Predictive Parsing
C. Shift reduce parser                                      D. Non-recursive predictive parsing

Q.7. Eliminate left-recursion from the following grammar :
S → (L) | a
L → L,S | S
After eliminating left-recursion we get,------

A] S → (L) | a
       L → SL'
       L'→ ,SL'|∈
B] S → (L) | a
       L → SL'
       L'→ ,SL'
C] S → (L) | a
       L → L'S
       L'→ ,SL'
D] None of the above.

Q.8. Which of the following statement is false.

A. Top-down parser uses derivation whereas Bottom-up uses reduction.
B. Top-down parsing uses LL(1) grammar whereas Bottom-up uses LR grammar.
C. Ambiguous grammar are not suitable for top-down parsing whereas ambiguous grammar is accepted by bottom-up parsing
D. None of the Above.

Q.9. Which one of the following grammars is free from left recursion?

A] S→ AB
A→ Aa | b
B→ c
B] S→ Ab |Bb | c
A→ Bd |∈
B→ e
C] S→ Aa |B
A→ Bb |Sc | ∈
B→ d
D] S→ Aa |Bb|c
A→ Bd |∈
B→ Ae |∈

Q.10. We can get an LL(1) grammar by ----------

A. Removing left recurrence
B. Applying left factoring
C. Removing left recurrence and Applying left factoring
D. None of the above.

Q.11. In LL(1) parsing algorithm,--------contains a sequence of grammar symbols.

A. Stack                                                                      B. Link List
C. Array                                                                      D. None of the above.

Q.12. Consider the following grammar
S→iEtSS′|a
S′→eS|ε
E→b
In the predictive parse table, M, of this grammar, the entries M[S′,e] and M[S′,ϕ] respectively are----------

A. {S′→eS} and {S′→ε}                                      B. {S′→eS} and { }
C. {S′→ε}and {S′→ε}code                                 D. {S′→eS, S′→ε} and {S′→ε}

Q.13. The variable which produces ∈ is called-----------

A. Empty variable                                                    B. Nullable variable
C. Terminal                                                               D. All of the above.

Q.14. Eliminate left recursion from the following grammar.
S→ Sa |b
which of the following is correct grammar.

A] S→bS'
S'→ aS'
B] S→bS'
S'→ aS'|∈
C] S→S'b
S'→ S'a|∈
D] None of the above.

Q.15. Match the following.
        List-I                                                       List-II
P) Lexical analysis                      (i) Leftmost derivation
Q) Top down parsing                 (ii) Type checking
R) Semantic analysis                  (iii) Regular expressions
S) Runtime environments          (iv) Activation records

A. P)-i Q)-ii R)-iv S)-iii                                               B. P)-iii Q)-i R)-ii S)-iv
C. P)-ii Q)-iii R)-i S)-iv                                               D. P)-iv Q)-i R)-ii S)-iii