LR Parser

Question 1
Marks : +2 | -2
Pass Ratio : 100%
Assembler is a program that _________
Puts programs into memory and executes them
Translates the assembly language into machine language
Writes in high level language and produces an object program
None of the mentioned
Explanation:
An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer’s processor can use to perform its basic operations.
Question 2
Marks : +2 | -2
Pass Ratio : 100%
An LR-parser can detect a syntactic error as soon as __________
The parsing starts
It is possible to do so a left-to-right scan of the input
It is possible to do so a right-to-left scan of the input
Parsing ends
Explanation:
Error is found when it the input string is scanned.
Question 3
Marks : +2 | -2
Pass Ratio : 100%
Which of the following is incorrect for the actions of A LR-Parser I) shift s ii) reduce A->ß iii) Accept iv) reject?
Only I)
I) and ii)
I), ii) and iii)
I), ii) , iii) and iv)
Explanation:
Only reject out of the following is a correct LR parser action.
Question 4
Marks : +2 | -2
Pass Ratio : 100%
What is the similarity between LR, LALR and SLR?
Use same algorithm, but different parsing table
Same parsing table, but different algorithm
Their Parsing tables and algorithm are similar but uses top down approach
Both Parsing tables and algorithm are different
Explanation:
The common grounds of these 3 parser is the algorithm but parsing table is different.
Question 5
Marks : +2 | -2
Pass Ratio : 100%
Which of the following is a phase of a compilation process?
Lexical Analysis
Code Generation
Lexical Analysis & Code Generation
None of the mentioned
Explanation:
Lexical analysis and code generation is a phase of compilation process.
Question 6
Marks : +2 | -2
Pass Ratio : 100%
Which of these is also known as look-head LR parser?
SLR
LR
LLR
None of the mentioned
Explanation:
LLR is the look ahead parser.
Question 7
Marks : +2 | -2
Pass Ratio : 100%
When ß (in the LR(1) item A -> ß.a,a) is not empty, the look-head _________
Will be affecting
Does not have any affect
Shift will take place
Reduction will take place
Explanation:
There is no terminal before the non terminal beta.
Question 8
Marks : +2 | -2
Pass Ratio : 100%
If a state does not know whether it will make a shift operation or reduction for a terminal is called _________
Shift/reduce conflict
Reduce /shift conflict
Shift conflict
Reduce conflict
Explanation:
As the name suggests that the conflict is between shift and reduce hence it is called shift reduce conflict.
Question 9
Marks : +2 | -2
Pass Ratio : 100%
Which of these is true about LR parsing?
Is most general non-backtracking shift-reduce parsing
It is still efficient
Is most general non-backtracking shift-reduce parsing & It is still efficient
None of the mentioned
Explanation:
LR parsers are a type of bottom-up parsers that efficiently handle deterministic context-free languages in guaranteed linear time.
Question 10
Marks : +2 | -2
Pass Ratio : 100%
The construction of the canonical collection of the sets of LR (1) items are similar to the construction of the canonical collection of the sets of LR (0) items. Which is an exception?
Closure and goto operations work a little bit different
Closure and goto operations work similarly
Closure and additive operations work a little bit different
Closure and associatively operations work a little bit different
Explanation:
Closure and goto do work differently in case of LR (0) and LR (1).