Compilers Questions and Answers – Implementation of the Translation Specified by Syntax-Directed Definitions – 1

This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Implementation of the Translation Specified by Syntax-Directed Definitions – 1”.

1. Which is not true about syntax and semantic parts of a computer language?
a) Semantics is checked mechanically by a computer
b) Semantics is the responsibility of the programmer
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: d
Explanation: Both in terms of semantics is not true.

2. Which of the following statement is true?
a) SLR powerful than LALR
b) LALR powerful than Canonical LR parser
c) Canonical LR powerful than LALR parser
d) The parsers SLR= Canonical LR=LALR
View Answer

Answer: c
Explanation: LR > LALR > SLR In terms of the parser.

3. Which of the following features cannot be captured by CFG?
a) Syntax of if-then-else statements
b) Syntax of recursive procedures
c) A variable is declared before its use
d) Matching nested parenthesis
View Answer

Answer: d
Explanation: It is because, it is equivalent to recognizing us, where the first w is the declaration and the second is its use, we are not a CFG.
advertisement
advertisement

4. In which of the following no information hiding is done?
a) Compile prig 1, prig 2
b) Run test, prog
c) Load R1, A
d) 001001000010101
View Answer

Answer: d
Explanation: The entire binary symbol gives information.

5. The identification of common sub-expression and replacement of run-time computations by compile-time computations is _____________
a) Local optimization
b) Loop optimization
c) Constant folding
d) Data flow analysis
View Answer

Answer: c
Explanation: Constant folding is the process of recognizing and evaluating constant expressions at compile time rather than computing them at runtime. Terms in constant expressions are typically simple literals they may also be variables whose values are assigned at compile time.

6. The graph that shows basic blocks and their successor relationship is called ____________
a) Dag
b) Flow Graph
c) Control Graph
d) Hamilton Graph
View Answer

Answer: b
Explanation: Flow graph shows the basic blocks.

7. The specific task storage manager performs ____________
a) Allocation/ deal location of programs
b) Protection of storage area assigned to the program
c) Allocation/ deal location of programs & protection of storage area assigned to the program
d) None of the mentioned
View Answer

Answer: c
Explanation: Its basic function is that of the task storage manager.
advertisement

8. When a computer is rebooted, a special type of loader is executed called?
a) Compile and GO ” loader
b) Boot loader
c) Bootstrap Loader
d) Relating Loader
View Answer

Answer: c
Explanation: A boot loader, is a small program that places the operating system (OS) of a computer into memory.

9. What is the disadvantage of ” Compile and GO ” loading scheme?
a) Memory is wasted because the case occupied by the assembler is unavailable to the object program
b) Necessary to translate the users program
c) It is very difficult to handle multiple segments, even when the source programs are in different languages and to produce orderly modular programs
d) All of the mentioned
View Answer

Answer: d
Explanation: In computer programming, a compile and go system, compile, load, and go system, assemble and go system, or load and go system[1][2][3] is a programming language processor in which the compilation, assembly, or link steps are not separated from program execution.
advertisement

10. What is the function of the storage assignment?
a) Assign storage to all variables referenced in the source program
b) Assign storage to all temporary locations that are necessary for intermediate results
c) Assign storage to literals, and to ensure that the storage is allocated and appropriate locations are initialized
d) All of the mentioned
View Answer

Answer: d
Explanation: The storage assignment performs the above mentioned tasks.

Sanfoundry Global Education & Learning Series – Compilers.

To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.