adplus-dvertising
frame-decoration

Question

Consider the following grammar:

S → Abc A → ab/ac/a

For Input string cad, how many times the recursive descent parser will backtrack?

a.

2

b.

3

c.

4

d.

5

Answer: (a).2

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Consider the following grammar: S → Abc A → ab/ac/a For Input string cad, how many times the recursive descent parser will backtrack?

Similar Questions

Discover Related MCQs

Q. The number of tokens in the following C statement is

printf("i = %d, &i = %x", i, &i);

Q. In a compiler, keywords of a language are recognized during

Q. The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?

Q. 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 (i.e., of type A -> є and A -> a) to parse a string with n tokens?

Q. Consider the following two sets of LR(1) items of an LR(1) grammar.

X -> c.X, c/d
X -> .cX, c/d
X -> .d, c/d
X -> c.X, $
X -> .cX, $
X -> .d, $

Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?

1. Cannot be merged since look aheads are different.
2. Can be merged but will result in S-R conflict.
3. Can be merged but will result in R-R conflict.
4. Cannot be merged since goto on c will lead to two different sets.

Q. The grammar S → aSa | bS | c is

Q. Match all items in Group 1 with correct options from those given in Group 2.

Group 1 Group 2

P. Regular expression 1. Syntax analysis
Q. Pushdown automata 2. Code generation
R. Dataflow analysis 3. Lexical analysis
S. Register allocation 4. Code optimization

Q. Which of the following statements are TRUE?

I. There exist parsing algorithms for some programming languages
whose complexities are less than O(n^3).
II. A programming language which allows recursion can be implemented
with static storage allocation.
III. No L-attributed definition can be evaluated in The framework
of bottom-up parsing.
IV. Code improving transformations can be performed at both source
language and intermediate code level.

Q. Which of the following describes a handle (as applicable to LR-parsing) appropriately?

Q. An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if

Q. Which one of the following is a top-down parser?

Q. Consider the grammar with non-terminals N = {S,C,S1 },terminals T={a,b,i,t,e}, with S as the start symbol, and the following set of rules:

S --> iCtSS1|a
S1 --> eS|ϵ
C --> b

The grammar is NOT LL(1) because:

Q. Consider the following two statements:

P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar

Which of the following is TRUE?

Q. Consider the following grammar.

S -> S * E
S -> E
E -> F + E
E -> F
F -> id

Consider the following LR(0) items corresponding to the grammar above.

(i) S -> S * .E
(ii) E -> F. + E
(iii) E -> F + .E

Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?

Q. A canonical set of items is given below

S --> L. > R
Q --> R.

On input symbol < the set has

Q. Consider the grammar defined by the following production rules, with two operators ∗ and +

S --> T * P
T --> U | T * U
P --> Q + P | Q
Q --> Id
U --> Id

Which one of the following is TRUE?

Q. 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

Q. Consider the following translation scheme. S → ER R → *E{print("*");}R | ε E → F + E {print("+");} | F F → (S) | id {print(id.value);} Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input '2 * 3 + 4', this translation scheme prints

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

Q. Consider the grammar

E → E + n | E × n | n

For a sentence n + n × n, the handles in the right-sentential form of the reduction are