 
			 
			MCQOPTIONS
 Saved Bookmarks
				This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Compilers knowledge and support exam preparation. Choose a topic below to get started.
| 1. | Consider the following C code segment. Which one to the following false? | 
| A. | The code contains loop-in variant computation | 
| B. | There is scope of common sub-expression elimination in this code | 
| C. | There is scope strength reduction in this code | 
| D. | There is scope of dead code elimination in this codeView Answer | 
| Answer» E. | |
| 2. | Consider the following translation scheme. Here id is a taken that represents an integer and id. value represents the corresponding integer value. For an input ‘2 * 3 + 4’, this translation scheme prints? | 
| A. | 2 * 3 + 4 | 
| B. | 2 * + 3 4 | 
| C. | 2 3 * 4 + | 
| D. | 2 3 4 + *View Answer | 
| Answer» C. 2 3 * 4 + | |
| 3. | Consider the following grammar: 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 ” ε}View Answer | 
| Answer» B. {S ” FR} and {} | |
| 4. | Consider the following grammar. Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar? | 
| A. | (i) and (ii) | 
| B. | (ii) and (iii) | 
| C. | (i) and (iii) | 
| D. | None of the mentionedView Answer | 
| Answer» D. None of the mentionedView Answer | |
| 5. | What precedence and associativity properties does the generated parser realize? | 
| A. | Equal precedence and left associativity; expression is evaluated to 7 | 
| B. | Equal precedence and right associativity, expression is evaluated to 9 | 
| C. | Precedence of ‘x’ is higher than that of ‘+’, and both operators are left associative; expression is evaluated to 7 | 
| D. | Precedence of ‘ # ‘ is higher than that of ‘#’, and both operators are left associative; expression is evaluated to 9 | 
| Answer» C. Precedence of ‘x’ is higher than that of ‘+’, and both operators are left associative; expression is evaluated to 7 | |
| 6. | Which one of the following is true about the action of yacc for the given grammar? | 
| A. | It detects recursion and eliminates recursion | 
| B. | It detects reduce-reduce conflict and resolves | 
| C. | It detects shift-reduce conflict and resolves the conflict in favor of a shift over a reduce action | 
| D. | It detects shift-reduce conflict and resolves the conflict in favor of a reduce over a shift action | 
| Answer» D. It detects shift-reduce conflict and resolves the conflict in favor of a reduce over a shift action | |
| 7. | Consider line 3. Identify the compiler’s response about this line while creating the object-module | 
| A. | No compilation error | 
| B. | Only a lexical error | 
| C. | Only syntactic errors | 
| D. | Both lexical and syntactic errorsView Answer | 
| Answer» D. Both lexical and syntactic errorsView Answer | |
| 8. | S -> (S)| aLet the number of states in SLR(1), LR(1) and LALR(1) parsers for the grammar n1 n2 and n3 respectively. | 
| A. | n1 < n2 < n3 | 
| B. | n1 = n3 < n2 | 
| C. | n1 = n2 = n3 | 
| D. | n1 $ n3 $ n2 | 
| Answer» C. n1 = n2 = n3 | |
| 9. | Consider the grammar. For a sentence n + n, form of the reduction are __________ | 
| A. | n, E + n and E + n # n | 
| B. | n , E + n and E + E # n | 
| C. | n , n + n and n + n # n | 
| D. | n , E + n and E # nView Answer | 
| Answer» E. | |
| 10. | The grammar A ->AA |( A)| ε is not suitable for predictive-parsing because the grammar is ___________ | 
| A. | Ambiguous | 
| B. | Left-recursive | 
| C. | Right-recursive | 
| D. | An operator-grammar | 
| Answer» B. Left-recursive | |