Explore topic-wise MCQs in Compilers.

This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Compilers knowledge and support exam preparation. Choose a topic below to get started.

1.

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?

A. Closure and goto operations work a little bit different
B. Closure and goto operations work similarly
C. Closure and additive operations work a little bit different
D. Closure and associatively operations work a little bit different
Answer» B. Closure and goto operations work similarly
2.

When ß is empty (A -> ß.,a), the reduction by A-> a is done by _________

A. If next symbol is a terminal
B. Only If the next input symbol is a
C. Only If the next input symbol is A
D. Only if the next input symbol is a
Answer» E.
3.

When ß (in the LR(1) item A -> ß.a,a) is not empty, the look-head _________

A. is not empty, the look-head _________a) Will be affecting
B. Does not have any affect
C. Shift will take place
D. Reduction will take place
Answer» C. Shift will take place
4.

When there is a reduce/reduce conflict?

A. If a state does not know whether it will make a shift operation using the production rule i or j for a terminal
B. If a state does not know whether it will make a shift or reduction operation using the production rule i or j for a terminal
C. If a state does not know whether it will make a reduction operation using the production rule i or j for a terminal
D. None of the mentioned
Answer» D. None of the mentioned
5.

If a state does not know whether it will make a shift operation or reduction for a terminal is called _________

A. Shift/reduce conflict
B. Reduce /shift conflict
C. Shift conflict
D. Reduce conflict
Answer» B. Reduce /shift conflict
6.

Which of the following is incorrect for the actions of A LR-Parser I) shift s ii) reduce A->ß iii) Accept iv) reject?

A. Only I)
B. I) and ii)
C. I), ii) and iii)
D. I), ii) , iii) and iv)
Answer» D. I), ii) , iii) and iv)
7.

Which of these is true about LR parsing?

A. Is most general non-backtracking shift-reduce parsing
B. It is still efficient
C. Is most general non-backtracking shift-reduce parsing & It is still efficient
D. None of the mentioned
Answer» D. None of the mentioned
8.

An LR-parser can detect a syntactic error as soon as __________

A. The parsing starts
B. It is possible to do so a left-to-right scan of the input
C. It is possible to do so a right-to-left scan of the input
D. Parsing ends
Answer» C. It is possible to do so a right-to-left scan of the input
9.

What is the similarity between LR, LALR and SLR?

A. Use same algorithm, but different parsing table
B. Same parsing table, but different algorithm
C. Their Parsing tables and algorithm are similar but uses top down approach
D. Both Parsing tables and algorithm are different
Answer» B. Same parsing table, but different algorithm
10.

Which of these is also known as look-head LR parser?

A. SLR
B. LR
C. LLR
D. None of the mentioned
Answer» D. None of the mentioned