Compiler Construction MCQ :Syntax Analysis(Parser)-Definition, Types of Parsers, Top-Down Parser : Link1

Compiler Construction MCQ :Syntax Analysis(Parser)-Definition, Types of Parsers, Top-Down Parser : Link1

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Syntax Analysis(Parser)-Definition, Types of Parsers, Top-Down 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. Syntax Analysis is the-----------phase of the compiler.

A. First                                                                      B. Second
C. Third                                                                    D. fourth

Q.2. Unrestricted grammar is also called-------Grammar

A. Type 0                                                                  B. Type 1
C. Type 2                                                                  D. Type 3

Q.3. Context Free Grammar (CFG) is also called ---------

A. Type 0 grammar                                                 B. Type 1 grammar
C. Type 2 grammar                                                 D. Type 3 grammar

Q.4. Backus–Naur Form (BNF) is useful in----------

A. Lexical analysis                                     B. Semantic analysis
C. Code optimization                               D. To describe the syntax of languages.

Q.5. Which of the following derivations does a top-down parser use while parsing an input string?

A. Leftmost derivation in reverse                  B. Leftmost derivation
C. Rightmost derivation                                  D. Rightmost derivation in reverse

Q.6.Match the following.
        List-I                                                List-II
P. Regular expression                     1. Syntax analysis
Q. Pushdown automata                 2. Code generation
R. Dataflow analysis                       3. Lexical analysis
S. Register allocation                     4. Code optimization

A. P-4. Q-1, R-2, S-3                                          B. P-3, Q-4, R-1, S-2
C. P-3, Q-1, R-4, S-2                                          D. P-2, Q-1, R-4, S-3

Q.7. Which of the following statements is false?

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

Q.8. Consider the following grammar
E→E+n|E×n|n
For a sentence n + n × n, the handles in the right-sentential form of the reduction are--------

A. n, E + n and E + n × n                                   B. n, E + n and n × n + E
C. n, n + n and n + n × n                                   D. n, E + n and E × n

Q.9. The grammar A→AA|(A)|ε
is not suitable for predictive-parsing because the grammar is---------.

A. left-recursive                                                                          B. ambiguous
C. right-recursive                                                                       D. operator-grammar

Q.10.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
For the correct answer strings Aabbab, how many derivation trees are there?

A. 1                                                                                     B. 2
C. 3                                                                                    D. 4

Q.11. Consider the following grammar:
S→FR,br> R→∗S|ε
F→id
In the predictive parser table, M, of the grammar the entries M[S,id] and M[R,$] respectively.

A. {S→FR} and { }                                                                  B. {S→FR} and {R→∗S}
C. {S→FR} and {R→ε}                                                           D. {F→id} and {R→ε}

Q.12. Left factoring guarantees----------

A. not occurring of backtracking                            B. cycle free parse tree
C. error free target code                                          D. correct LL(1) parsing table

Q.13. Eliminate left recursion from the following grammar.
E→E+T|T
T→T*F|F
F→(E)|id
which of the following is correct grammar.

A] E→TE'
E'→+TE'|∈
T→FT'
T'→FT'|∈
F→(E)|id
B] E→TE'
E'→+TE'
T→FT'
T'→FT'
F→(E)|id
C] E→E+T|T
T→T*F|F
F→(E)|id
D] None 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
a) Type 0             1. Finite state automaton
b) Type 1             2. Pushdown automaton
c) Type 2             3. Linear-bounded automaton
d) Type 3             4. Turing Machine

A. a)-4 b)-3 c)-2 d)-1                                         B. a)-1 b)-2 c)-3 d)-4
C. a)-1 b)-3 c)-2 d)-4                                        D. a)-3 b)-4 c)-1 d)-2