MCQOPTIONS
Saved Bookmarks
This section includes 28 Mcqs, each offering curated multiple-choice questions to sharpen your Theory of Computation and Compiler Design knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following statement(s) regarding a linker software is/are true? |
| A. | Only I |
| B. | Only II |
| C. | Both I and II |
| D. | Neither I nor II |
| Answer» B. Only II | |
| 2. |
Consider the grammar defined by the following production rules, with two |
| A. | + is left associative, while ∗ is right associative |
| B. | + is right associative, while ∗ is left associative |
| C. | Both + and ∗ are right associative |
| D. | Both + and ∗ are left associative |
| Answer» C. Both + and ∗ are right associative | |
| 3. |
Consider the following grammar. |
| A. | (i) and (ii) |
| B. | (ii) and (iii) |
| C. | (i) and (iii) |
| D. | None of the above |
| Answer» E. | |
| 4. |
Consider the following expression grammar. The seman-tic rules for expression |
| 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 | |
| 5. |
Consider the following two sets of LR(1) items of an LR(1) grammar. |
| A. | 1 only |
| B. | 2 only |
| C. | 1 and 4 only |
| D. | 1, 2, 3, and 4 |
| Answer» E. | |
| 6. |
Consider the following grammars |
| A. | Only (S1), (S2) and (S3), (S4) |
| B. | Only (S1), (S3) and (S2), (S4) |
| C. | Only (S2), (S3) and (S1), (S4) |
| D. | None of the above |
| Answer» C. Only (S2), (S3) and (S1), (S4) | |
| 7. |
Consider the following grammar: |
| A. | {S → FR} and {R → ε } |
| B. | {S → FR} and { } |
| C. | {S → FR} and {R → *S} |
| D. | {F → id} and {R → ε} |
| Answer» B. {S → FR} and { } | |
| 8. |
A canonical set of items is given below |
| A. | a shift-reduce conflict and a reduce-reduce conflict. |
| B. | a shift-reduce conflict but not a reduce-reduce conflict. |
| C. | a reduce-reduce conflict but not a shift-reduce conflict. |
| D. | neither a shift-reduce nor a reduce-reduce conflict. |
| Answer» E. | |
| 9. |
Consider the following expression |
| A. | x1 = a - b y1 = p * c x2 = u * v y2 = p + q |
| B. | x 1 = a - b y1 = x2 * c x3 = u * v y2 = x4 + y3 |
| C. | x1 = a - b y2 = x1 * c x2 = u * v y3 = x2 + y2 |
| D. | p = a - b q = p * c p = u * v q = p + q |
| Answer» D. p = a - b q = p * c p = u * v q = p + q | |
| 10. |
Which of the following macros can put a micro assembler into an infinite loop? |
| A. | (ii) only |
| B. | (i) only |
| C. | Both (i) and (ii) |
| D. | None of the above |
| Answer» B. (i) only | |
| 11. |
Consider the translation scheme shown below |
| A. | 9 + 5 + 2 |
| B. | 9 5 + 2 + |
| C. | 9 5 2 + + |
| D. | + + 9 5 2 |
| Answer» C. 9 5 2 + + | |
| 12. |
Which of the following grammar rules violate the requirements of an operator grammar ? P, Q, R are nonterminals, and r, s, t are terminals. |
| A. | 1 only |
| B. | 1 and 3 only |
| C. | 2 and 3 only |
| D. | 3 and 4 only |
| Answer» C. 2 and 3 only | |
| 13. |
Consider the intermediate code given below: |
| A. | 5 and 7 |
| B. | 6 and 7 |
| C. | 5 and 5 |
| D. | 7 and 8 |
| Answer» C. 5 and 5 | |
| 14. |
Consider the following code segment. |
| A. | 6 |
| B. | 8 |
| C. | 9 |
| D. | 10 |
| Answer» E. | |
| 15. |
In multi-programmed systems, it is advantageous if some programs such as editors and compilers can be shared by several users. Which of the following must be true of multi-programmed systems in order that a single copy of a program can be shared by several users? |
| A. | I only |
| B. | II only |
| C. | Ill only |
| D. | I, II and III |
| Answer» D. I, II and III | |
| 16. |
The grammar whose productions are |
| A. | a |
| B. | b |
| C. | c |
| D. | d |
| Answer» E. | |
| 17. |
Consider the following C code segment. |
| A. | The code contains loop invariant computation |
| B. | There is scope of common sub-expression elimination in this code |
| C. | There is scope of strength reduction in this code |
| D. | There is scope of dead code elimination in this code |
| Answer» E. | |
| 18. |
Consider the grammar with the following translation rules and E as the start symbol. |
| A. | 200 |
| B. | 180 |
| C. | 160 |
| D. | 40 |
| Answer» D. 40 | |
| 19. |
Match all items in Group 1 with correct options from those given in Group 2. |
| A. | P-4. Q-1, R-2, S-3 |
| B. | P-3, Q-1, R-4, S-2 |
| C. | P-3, Q-4, R-1, S-2 |
| D. | P-2, Q-1, R-4, S-3 |
| Answer» C. P-3, Q-4, R-1, S-2 | |
| 20. |
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 |
| A. | aaaabb |
| B. | aabbbb |
| C. | aabbab |
| D. | abbbba |
| Answer» D. abbbba | |
| 21. |
Consider the following context free languages: |
| A. | L1, L2 and L3 can be recognized by Deterministic Push down automata |
| B. | L1, L2 can be recognized by Deterministic Push down automata |
| C. | L1, L3 can be recognized by Deterministic Push down automata |
| D. | None of the above |
| Answer» D. None of the above | |
| 22. |
Consider the following statements related to compiler construction : |
| A. | Only I |
| B. | Only II |
| C. | Both I and II |
| D. | Neither I nor II |
| Answer» E. | |
| 23. |
Which of the following are decidable ? |
| A. | 1 and 2 |
| B. | 1 and 4 |
| C. | 2 and 3 |
| D. | 2 and 4 |
| Answer» C. 2 and 3 | |
| 24. |
Consider the following decision problems: |
| A. | Both (P1) and (P2) are decidable |
| B. | Neither (P1) nor (P2) are decidable |
| C. | Only (P1) is decidable |
| D. | Only (P2) is decidable |
| Answer» B. Neither (P1) nor (P2) are decidable | |
| 25. |
Consider the following two problems on undirected graphs: |
| A. | α is in P and β is NP-complete |
| B. | α is NP complete and β is in P |
| C. | Both α and β are NP-complete |
| D. | Both α and β are in P |
| Answer» C. Both α and β are NP-complete | |
| 26. |
Which of the following problems are decidable? |
| A. | 1, 2, 3, 4 |
| B. | 1, 2 |
| C. | 2, 3, 4 |
| D. | 3, 4 |
| Answer» E. | |
| 27. |
Consider the language L1,L2,L3 as given below. |
| A. | Push Down Automata (PDA) can be used to recognize L1 and L2 |
| B. | L1 is a regular language |
| C. | All the three languages are context free |
| D. | Turing machine can be used to recognize all the three languages |
| Answer» D. Turing machine can be used to recognize all the three languages | |
| 28. |
Consider the languages |
| A. | Only L2 is context free |
| B. | Only L2 and L3 are context free |
| C. | Only L1 and L2 are context free |
| D. | All are context free |
| Answer» E. | |