Explore topic-wise MCQs in Compilers.

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

1.

Consider the grammar rule. E -> E1 − E2 for arithmetic expressions. If E1 and E2 do not have any common sub expression, in order to get the shortest possible code.

A. E1 should be evaluated first
B. E2 should be evaluated first
C. Evaluation of E1 and E2 should necessarily be interleaved
D. Order of evaluation of E1 and E2 is of no consequence
Answer» C. Evaluation of E1 and E2 should necessarily be interleaved
2.

Which grammar violate rules of an operator grammar?

A. (i) only
B. (i) and (iii) only
C. (ii) and (iii) only
D. (iii) and (iv) onlyView Answer
Answer» C. (ii) and (iii) only
3.

Which of the following is NOT an advantage of using shared, dynamically linked libraries as compared to statically linked libraries?

A. Smaller sizes of executable
B. Lesser overall page fault rate in the system
C. Faster program start-up
D. Existing programs need not be re-linked to take advantage of newer versions of libraries
Answer» D. Existing programs need not be re-linked to take advantage of newer versions of libraries
4.

If dynamic scoping is used and call by name mechanism is used, the values printed will be?

A. 115, 220
B. 25, 220
C. 25, 15
D. 115, 105
Answer» C. 25, 15
5.

If the programming language uses static scoping and call by need parameter passing mechanism, the values printed will be?

A. 115, 220
B. 25, 220
C. 25, 15
D. 115, 105
Answer» E.
6.

The 3-address code sequence generated by which definition?

A. X = Y + Z
B. t1 = Y + Z; X t1
C. t1 = Y; t2 = t1 + Z; X = t2
D. t1 = Y; t2 = Z; t3 + t2; X = t3View Answer
Answer» E.
7.

What is grammar?

A. LL (1)
B. SLR (1) but not LL (1)
C. LALR (1) but not SLR (1)
D. LR (1) but not LALR (1)View Answer
Answer» D. LR (1) but not LALR (1)View Answer
8.

Dynamic linking can cause security concerns because ______________

A. Security is dynamic
B. None of the mentioned
C. Security is dynamic & Cryptographic procedures are not available for dynamic linking
D. Cryptographic procedures are not available for dynamic linking
Answer» E.