

MCQOPTIONS
Saved Bookmarks
This section includes 7 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 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 onlyView Answer |
Answer» E. | |
2. |
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production to parse a string with n tokens? |
A. | n/2 |
B. | n-1 |
C. | 2n-1 |
D. | 2^n |
Answer» C. 2n-1 | |
3. |
Consider the following grammar G. Which one is true?S1: All strings generated by G can be parsed with help of LL (1).S2: All strings generated by G can be parsed with help of LR (1). |
A. | Only S1 |
B. | Only S2 |
C. | Both S1 & S2 |
D. | None of the mentionedView Answer |
Answer» E. | |
4. |
Which of the following pairs is the most powerful? |
A. | SLR, LALR |
B. | Canonical LR ,LALR |
C. | SLR canonical LR |
D. | LALR canonical LR |
Answer» D. LALR canonical LR | |
5. |
In the context of abstract-syntax-tree and control-flow-graph. Which one of the following is true? |
A. | In both AST and CFG if node N2 be the successor of node N1 |
B. | For any input program, neither AST nor CFG will contain a cycle |
C. | The max number of successors of a node in an AST and a CFG depends on the input program |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
6. |
Which one of the following is true at any valid state in shift-reduce parsing? |
A. | At the bottom we find the prefixes |
B. | None of the mentioned |
C. | Stack contains only viable prefixes |
D. | Stack consists of viable prefixes |
Answer» D. Stack consists of viable prefixes | |
7. |
What is the grammar for the below equations? |
A. | LL(1) |
B. | SLR(1) but not LL(1) |
C. | LALR(1) but not SLR(1) |
D. | LR(1) but not LALR(1)View Answer |
Answer» B. SLR(1) but not LL(1) | |