Test: Parsing Techniques- 2

15 Questions MCQ Test Question Bank for GATE Computer Science Engineering | Test: Parsing Techniques- 2

This mock test of Test: Parsing Techniques- 2 for Computer Science Engineering (CSE) helps you for every Computer Science Engineering (CSE) entrance exam. This contains 15 Multiple Choice Questions for Computer Science Engineering (CSE) Test: Parsing Techniques- 2 (mcq) to study with solutions a complete question bank. The solved questions answers in this Test: Parsing Techniques- 2 quiz give you a good mix of easy questions and tough questions. Computer Science Engineering (CSE) students definitely take this Test: Parsing Techniques- 2 exercise for a better result in the exam. You can find other Test: Parsing Techniques- 2 extra questions, long questions & short questions for Computer Science Engineering (CSE) on EduRev as well by searching above.

Which of the following actions an operator- precedence parser may take to recover from an error?


To recover from an error actions taken by operator precedence parser:
1. Insert symbols onto stack.
2. Delete symbols from the stack.
3. Insert or delete symbols from the input.


Which of the following is the important factor that justifies the use of a stack in shift-reduce parsing?


In shift-reduce parsing "the handle will always appear inside the stack and reversor top”.


A shift reduce parser carries out the actions specified with in braces immediately after reducing the corresponding rule of grammar.

What is the translation of bbbbacc using the syntax directed translation scheme described by the above rules?



Which of the following statement is correct about parsing?
1. Top-down parsing expands the start symbol to the required string needed whereas in bottom-up parsing reduces the syntax to the start symbol.
2. Top-down parsing is implemented using the set of recursive procedures and implementation of bottom-up parsing is done using the stacks and input buffer.
3. Backtracking is required for both bottom-up and top-down parsing implementation.

  • Top down parsing expands the start symbol to the required string needed where as in bottom up parse string reduces to start symbol by handle purring.
  • Top down parser also known as recursive descent parser i.e. uses recursive procedure, where as bottom up parser user stack and input buffer.
  • Backbacking is required in top-down parser but not in bottom up.

Which statement is true?

  • LALR is less powerful than CLR but more costly than any parser.
  • Every SLR grammar is unambigous but every unambigous grammar need not be SLR i.e. may be LALR but not SLR. 
  • LR(K) grammar never using backtracking.

For a context-free grammar, FOLLOW(A) is the set of terminals that can appear immediately to the right of non-terminal A in some “sentential” form. We defined to sets LFOLLOW(A) and RFOLLOW(A) by replacing the word “left most sentential” and “right most sentential” respectively in the definition of FOLLOW(A).

Which of the following statements is/are true


Definition of Follow (A) as per question “The set of terminals that can appears immediately to the right of non-terminal A in same sentential form”. If the above definition is changed to replace “ sentential” with “ left-most sentential” for L FOLLOW (A) and “right-most sentential” for R FOLLOW (A)

We are still considering the terminal symbol to the right of A ’ .
Hence all three sets would be identical


Consider the SLR(1) and LALR(1) parsing tables for a context free grammar. Which of the following statements is/are true?


In SLR (1) and LALR (1) parsing tables for CFG shift entries and Goto part are identical but reduced entries and error entries may be different


Which of the following statements is false?


An ambiguous grammar have more than one leftmost or rightmost derivation tree.


Consider the following expression grammar, The semantic rules for expression calculation-are stated next to each grammar production.

The above grammar and the semantic rules are fed to a yacc tool (which is an LALR(1) parser generator) for parsing and evaluating arithmetic expressions. Which one of the following is true about the action of yacc for the given grammar?


E→ number \ E' + E' \ E' x E'

Then YACC compiler detects shift-reduce conflict, and resolves the conflict in favor of a shift over a reduce action.
Consider the following configuration where shift- reduce conflict occurs

Stack Input

.... E + E x . E . . $


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


A handle may be described as the sentencial form given by the bottom up parser from left to right in reverse order.


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


LALR(1) parser for a grammar, G can have shift- reduce ( S - R) conflicts if and only if there is a S - R conflict in its immediate sub-parsers (e.g. LR(1)). If LR(0) has S - R conflicts then they may get removed in LR (1), hence there will be no S - R conflict in LALR(1).


Consider the following grammar production: 

Which of the following is not LR(1) item set?


So, parsing table must not contain entry 

 since Y→a production not present in grammar.


Consider the production:

S→ aS | b

The parsing automation is below:

Which of the following stack contents causes the parser to reduce by some production?


Some possible stack contents are aaS, ab, b, etc.


Consider the following grammar production: 

The expression 3 + 2 x 5 is parsed by the shift- reduce parser then which of the following is not a handle for it?


So E + E x E is not a handle for the expression.


Consider a grammar:

The input string ccbca is parsed by which of the following parsing method?


Given grammar can be parsed using both Top- down and bottom up parsing methods for the input string “ccbca"

Similar Content

Related tests