MCQOPTIONS
Saved Bookmarks
This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Compilers knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states. |
| 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 mentioned |
| Answer» C. n1 is necessarily greater than n2 | |
| 2. |
Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar? |
| A. | Removing left recursion only |
| B. | Factoring the grammar alone |
| C. | Factoring & left recursion removal |
| D. | None of the mentioned |
| Answer» E. | |
| 3. |
Consider a program P that consists of two source modules M1(contains reference to a function defined in M2) and M2 contained in two different files. |
| A. | Edit time |
| B. | Compile time |
| C. | Link time |
| D. | Load time |
| Answer» D. Load time | |
| 4. |
Given the following expression grammar: which of the following is true? |
| A. | * has higher precedence than + |
| B. | – has higher precedence than * |
| C. | + and — have same precedence |
| D. | + has higher precedence than *View Answer |
| Answer» C. + and — have same precedence | |
| 5. |
Compute E.value for the root of the parse tree for the expression:2 # 3 & 5 # 6 &4. |
| A. | 200 |
| B. | 180 |
| C. | 160 |
| D. | 40 |
| Answer» D. 40 | |
| 6. |
Which of the following grammar rules violate the requirements of an operator grammar? |
| A. | (i) only |
| B. | (i) and (iii) only |
| C. | (ii) and (iii) only |
| D. | (iii) and (iv) onlyView Answer |
| Answer» C. (ii) and (iii) only | |
| 7. |
The process of assigning load addresses to the various parts of the program and adjusting the code and data in the program to reflect the assigned addresses is called? |
| A. | Assembly |
| B. | Parsing |
| C. | Relocation |
| D. | Symbol resolute |
| Answer» D. Symbol resolute | |
| 8. |
Which of the following derivations does a top-down parser use while parsing an input string? |
| A. | Leftmost derivation |
| B. | Leftmost derivation in reverse |
| C. | Rightmost derivation |
| D. | Rightmost derivation in reverse |
| Answer» B. Leftmost derivation in reverse | |