Explore topic-wise MCQs in Compilers.

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.

Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states?

A. n1 is necessarily less than n2
B. n1 is necessarily equal to n2
C. n1 is necessarily greater than n2
D. None of the mentioned
Answer» C. n1 is necessarily greater than n2
2.

Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

A. Removing left recursion only
B. Factoring the grammar alone
C. Factoring & left recursion removal
D. None of the mentioned
Answer» E.
3.

Consider a program P that consists of two source modules M1(contains reference to a function defined in M2) and M2 contained in two different files.

A. Edit time
B. Compile time
C. Link time
D. Load time
Answer» D. Load time
4.

Compute E.value for the root of the parse tree for the expression:2 # 3 & 5 # 6 &4.

A. 200
B. 180
C. 160
D. 40
Answer» D. 40
5.

Which of the following grammar rules violate the requirements of an operator grammar?

A. P -> QR
B. P -> QsR
C. P -> ε
D. P -> QtRr
Answer» C. P -> ‚âà√≠¬¨¬µ
6.

The process of assigning load addresses to the various parts of the program and adjusting the code and data in the program to reflect the assigned addresses is called

A. Assembly
B. Parsing
C. Relocation
D. Symbol resolute
Answer» D. Symbol resolute
7.

Which of the following derivations does a top-down parser use while parsing an input string?

A. Leftmost derivation
B. Leftmost derivation in reverse
C. Rightmost derivation
D. Rightmost derivation in reverse
Answer» B. Leftmost derivation in reverse