Compiler Construction MCQ :Syntax Directed Definition-SDT, SDD : Link1

Compiler Construction MCQ :Syntax Directed Definition-SDT, SDD : Link1

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Syntax Directed Definition-Syntan Directed Translation, Syntax Directed Definition-inherited, synthesized attributes? 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. A grammar oriented compiling technique known as--------------

A. Syntax directed translation
B. Data flow translation
C. Two pass compiler
D. None of the above.

Q.2. Type checking is normally done during-----------

A. Lexical analysis
B. Syntax Analysis
C. Syntax directed translation
D. Code optimization

Q.3. A parse tree showing the value of attributes at each node is called----------

A. Syntax tree                                           B. Annotated parse tree
C. Semantic tree                                      D. All of the above.

Q.4. Inherited attribute is a natural choice in----------

A. keeping track of variable declaration
B. checking for the correct use of L-values and R-values
C. both (A) and (B)
D. None of the above.

Q.5. Syntax directed translation scheme is desirable because-------

A. it is based on the syntax
B. its description is independent of any implementation
C. it is easy to modify
D. All of the above.

Q.6. A synthesized attribute is an attribute whose value at a parse tree node depends on -------

A. Attributes at the siblings only                          B. Attributes at parent node only
C. Attributes at children nodes only                    D. None of the above.

Q.7. A inherited attribute is an attribute whose value at a parse tree node not depends on------

A. Attributes at the siblings only                      B. Attributes at parent node only
C. Attributes at children nodes only                D. None of the above.

Q.8. Attributes whose values are defined in terms of a node’s own attributes, node’s siblings and node’s parent are called--------

A. Inherited attributes                                      B. Physical attributes
C.Logical attributes                                          D. Un-synthesized attributes

Q.9. The--------translation statements can be conveniently specified in YACC.

A. Syntax-directed                                            B. Image-directed
C. Sign-directed                                                 D. Segment-directed

Q.10. In a bottom up evaluation of a syntax direction definition, inherited attributes can-------

A. always be evaluated
B. be evaluated only if the definition is L –attributed
C. evaluation only done if the definition has synthesized attributes
D. None of the above.

Q.11. Synthesized attribute can be easily simulated by a---------

A. LL grammar                                                    B. Ambiguous grammar
C. LR grammar                                                    D. None of the above.

Q.12. In synthesize attribute, we can evaluate in------------order.

A. Bottom-up                                                      B. Top-down
C. Preorder                                                          D. None of the above.

Q.13. In inherited attribute, we can evaluate in---------order.

A. Bottom-up                                                      B. Top-down
C. postorder                                                       D. None of the above

Q.14. An SDD without side effects is called ---------

A. Context free grammar
B. Operator grammar
C. Attribute grammar
D. Both A and C

Q.15. An SDD that involves only synthesized attributes is called--------

A. S-attributed                                                   B. L-attributed
C. Both A and B                                                  D. None of the above.

Compiler Construction MCQ :Syntax Analysis(Parser)-LR parser, YACC : Link7

Compiler Construction MCQ :Syntax Analysis(Parser)-LR parser, YACC : Link7

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Syntax Analysis(Parser)-LR parser, YACC? 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. YACC stand for-----------

A. es Another Compiler Compiler
B. Yet Another Compile Compiler
C. Yet Another Compiler Compiler
D. Yes Another Compile Compiler

Q.2. The YACC takes C code as input and outputs----------

A. Top down parsers
B. Bottom up parsers
C. Machine code
D. None of the above.

Q.3. Which of the following software tool is parser generator ?

A. Lex                                                         B. Yacc
C. Both A and B                                        D. None of the above

Q.4. The output of YACC---------

A. y.tab.c                                                   B. lex.yy.c
C. yacc.c                                                   D. None of the above.

Q.5.The output of LEX-----

A. y.tab.c                                                   B. lex.yy.c
C. lex.c                                                      D. None of the above.

Q.6. Findout the incorrect statement from the following statements.

A. YACC is parser generator.
B. Every SLR(1) grammar is unambiguous.
C. LL(1) language cannot have left-recursive production
D. Number of states of SLR parsing are more than that of LR parsing.

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

Compiler Construction MCQ :Syntax Analysis(Parser)-LEADING & TRAILING, Operator Precedence Parser & Grammar : Link5

Compiler Construction MCQ :Syntax Analysis(Parser)-LEADING & TRAILING, Operator Precedence Parser & Grammar : Link5

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Syntax Analysis(Parser)-LEADING & TRAILING, Operator Precedence Parser & Grammar ? 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 is not a shift reduce parser action.

A. Shift                                                                           B. goto
C. Reduce                                                                      D. Accept

Q.2. The operator precedence parsing not uses-----precedence relation.

A. <                                                                                  B. >
C. =                                                                                  D. >=

Q.3. ---------grammars have the restriction that no production has either an empty right-hand side (ε) or two adjacent non-terminals in its right-hand side.

A. operator precedence                                                B. precedence
C. operator                                                                     D. None of the above

Q.4. Which of these have highest precedence?

A. *                                                                                   B. ++
C. >>                                                                                 D. ()

Q.5. Which is not the operator precedence relations?

A. a>=b                                                                             B. a ⋗ b
C. a ⋖ b                                                                            D. a ≐ b

Q.6. What is the LEADING(S) for the following grammar?
S➔S-B|B
B➔B*A|A
A➔(S)|id

A. LEADING(S)={-,*,),id}                                                 B. LEADING(S)={-,*,(,)}
C. LEADING(S)={-,*,(,id}                                                 D. LEADING(S)={-,*,(}

Q.7. What is the TRAILING(S) for the following grammar?
S➔S-B|B
B➔B*A|A
A➔(S)|id

A. TRAILING(S)={-,*,),id}                                                B. TRAILING(S)={-,*,(,)}
C. TRAILING(S)={-,*,(,id}                                                D. TRAILING(S)={-,*,(}

Q.8. What is the similarity between LR, LALR and SLR?

A. Use same algorithm, but different parsing table.
B. Same parsing table, but different algorithm.
C. Their Parsing tables and algorithm are similar but uses top down approach.
D. Both Parsing tables and algorithm are different.

Q.9. An LR-parser can detect a syntactic error as soon as-------.

A. The parsing starts
B. It is possible to do so a left-to-right scan of the input.
C. It is possible to do so a right-to-left scan of the input.
D. Parsing ends

Q.10. Which of these is true about LR parsing?

A. Is most general non-backtracking shift-reduce parsing.
B. It is still efficient.
C. LR means the input scans from left to right and generate rightmost derivation in reverse.
D. All of the above.

Q.11.Which function is uesd to map terminal symbols to integers in Operator precedence parsers?

A. precedence functions                                               B. operator function
C. operand function                                                       D. None of the above.

Q.12. For parsing arithmetic expressions, involving (, ), + and - , the precedence relation between - and -, will be <, if-------

A. minus is left associative                                             B. minus is right associative
C. we are talking of unary minus                                  D. a ( comes in between

Q.13. The precedence relation between ) and ( will be --------

A. <                                                                                    B. >
C. =                                                                                    D. undefined

Q.14. LR stands for-------

A. Left to right                    B. Left to right reduction
C. right to left                     D. Left to right and right-most derivation in reverse.

Q.15. What is the TRAILING(T) for the following grammar?
E➔E+T|T
T➔T*F|F
F➔id|(E)

A. TRAILING(T)={+,*,(}                                                    B. TRAILING(T)={*,id,(}
C. TRAILING(T)={*,id,)}                                                  D. TRAILING(T)={+,*,id}

Compiler Construction MCQ :Syntax Analysis(Parser)-Bottom-up parser, Operator Precedence Parser : Link4

Compiler Construction MCQ :Syntax Analysis(Parser)-Bottom-up parser, Operator Precedence Parser : Link4

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Bottom-up parser, Operator Precedence 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. Which is not a shift reduce parser action.

A. Shift                                                                           B. goto
C. Reduce                                                                      D. Accept

Q.2. Reverse of a right most derivation is called ------------.

A. reduction                                                                  B. production
C. handle                                                                       D. base

Q.3. The canonical reduction sequence is obtained by ------.

A. reduction                                                                  B. handle
C. production                                                               D. handle pruning

Q.4. Stack is pushed with --------------- symbol.

A. $                                                                                 B. %
C. *                                                                                 D. &

Q.5. LR Parser is a ------------parser.

A. Bottom-Up                                                              B. Top-Down
C. forward                                                                    D. reverse

Q.6. LR parser construct a -----------type of derivation.

A. MMD                                                                         B. RMD
C. LMD                                                                          D. CLR

Q.7. A bottom-up parser generates--------

A. Left-most derivation in reverse                            B. Left-most derivation
C. Right-most derivation in reverse                          D. Right–most derivation

Q.8. The bottom-up parsing method is also called--------

A. Shift reduce parsing                                                B. Predictive parsing
C. Recursive descent parsing                                     D. None of the Above.

Q.9. A shift reduce parser suffers from-------.

A. shift reduce conflict only
B. reduce reduce conflict only
C. shift handle and reduce handle conflicts
D. both shift reduce conflict and reduce reduce conflict

Q.10. The parser cannot decide whether action is shift or reduce. This is called-------

A. Reduce /shift conflict                                            B. Shift/reduce conflict
C. Shift conflict                                                            D. Reduce conflict

Q.11. --------is the most powerful parser.

A. operator precedence                                              B. LALR
C. canonical LR                                                            D. SLR

Q.12. The parser cannot decide which reduction have to be made among many reductions. This is called-------

A. Reduce-shift conflict                                              B. Reduce-Reduce conflict
C. shift-shift conflict                                                   D. shift-Reduce conflict

Q.13. which data structure is used for shift reduce parsing?

A. stack                                                                           B. array
C. queue                                                                         D. pointer variable

Q.14. In operator precedence parsing, precedence relations are defined-------

A. for all pair of non-terminals                                    B. for all pair of terminals
C. to delimit the handle                                                D. None of the above.

Q.15. Which of the following grammar rules violate the requirements of an operator grammar? P, Q, R are nonterminal and s, r, s, t are terminals.
1. P→QR
2. P→QsR
3. P→ε
4. P→QtRr

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

Compiler Construction MCQ :Syntax Analysis(Parser)-Recursive Descent Parsing , LL(1), FIRST & FOLLOW : Link3

Compiler Construction MCQ :Syntax Analysis(Parser)-Recursive Descent Parsing , LL(1), FIRST & FOLLOW : Link3

Compiler Construction MCQ & Answers

       Are you worried about the answers to Compiler Construction questions :Recursive Descent Parsing , LL(1), FIRST & FOLLOW? 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. The grammar S → aSa | bS | c is-------

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

Q.2. Consider the following grammar:
S → FR
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 {R → ε }                                               B. {S → FR} and { }
C. {S → FR} and {R → *S}                                             D. {F → id} and {R → ε}

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

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

Q.4. Predictive parser can be ?

A. Recursive                                                                   B. Constructive
C. Non recursive                                                           D. Both A and B

Q.5. Which of the following is NOT a bottom up, shift reduce parser?

A. LL parser                                                                    B. LR parser
C. SLR parser                                                                 D. LALR parser

Q.6. The parsing technique that avoids backtracking is-------

A. Recursive Descent Parsing                                      B. Predictive Parsing
C. Syntax tree                                                                D. Top-down parsing

Q.7. Which of the following is true for a predictive parser?

A. Recursive Descent parser                                                     B. no backtracking
C. Recursive Descent parser and no backtracking                D. None of the above.

Q.8. Calculate the First(D) and Follow(B) functions for the given grammar-
S → aBDh
B → cC
C → bC / ∈
D → EF
E → g / ∈
F → f / ∈

A. First(D)={ g , f , ∈ } & Follow(B)= { g , f , h }
B. First(D)={ g , ∈ } & Follow(B)= { g , ∈ }
C. First(D)={ g , f , ∈ } & Follow(B)= { g , f }
D. First(D)={ g , f } & Follow(B)= { g , f , h }

Q.9. Calculate the First(S) and Follow(A) functions for the given grammar-
S → AaAb / BbBa
A → ∈
B → ∈

A] First(S)={ a, ∈ } and Follow(A)={ a, b }
B] First(S)={ a, b } and Follow(A)={ a, b }
C] First(S)={∈, ∈ } and Follow(A)={ a, b }
D] First(S)={ a, b } and Follow(A)={ a, ∈ }

Q.10. Predictive parser can be constructed for class of--------grammar.

A. LL(1)                                                                          B. LR(1)
C. CLR(1)                                                                       D. LALR(1).

Q.11. State True or False. "LL(1) grammar cannot be ambiguous."

A. True                                                                           B. False

Q.12. Findout First and Follow of following grammar
S→A |a
|A→a

A. First(S)={a} ,First(A)={a} , Follow(S)={$} , Follow(A)={$}
B. First(S)={a} ,First(A)={a} , Follow(S)={$} , Follow(A)={a}
C. First(S)={a} ,First(A)={a} , Follow(S)={a} , Follow(A)={$}
D. First(S)={$} ,First(A)={$} , Follow(S)={a} , Follow(A)={a}

Q.13. A graphical representation for derivations that filter out the choice regarding replacement order is called the ---------.

A. graph tree                                                               B. syntax tree
C. parse tree                                                                D. symbol tree

Q.14. A parser for Grammar G is a program that takes as input string W and produces as output is ------- for W.

A. parse tree                                                                B. error message
C. string                                                                        D. None of the above.

Q.15. In a top-down parser, the starting --------is expanded to derive the given input string.

A. terminal                                                                    B. letter
C. digit                                                                          D. non-terminal

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