CYBERSECURITY-ARCHITECTURE-AND-ENGINEERING practice question 12 of 30
What is a function of a compiler?
Full set: 232 questionsDomain Cybersecurity Principles
A compiler is a specialized computer program that translates the entire source code of a program, written in a high-level programming language (like C++ or Java), into a lower-level language, typically machine code. The result of this translation is a standalone executable file. This executable can then be run by a user or another program at a later time, directly on the target computer's processor, without needing the compiler or the original source code again. This "translate-then-run" process is the defining characteristic of a compiler.
B. This describes the function of an interpreter, which translates and executes a program one instruction or line at a time, rather than creating a separate executable file beforehand.
C. This describes a source-to-source compiler, also known as a transpiler. While a type of compiler, its primary function is not the general case, which is translation to a lower-level language.
D. This function is more closely related to a linker, which combines multiple object or executable files, or a decompiler, which attempts to reverse the compilation process into a readable format.
1. Aho, A. V., Lam, M. S., Sethi, R., & Ullman, J. D. (2007). Compilers: Principles, Techniques, & Tools (2nd ed.). Pearson/Addison Wesley.
In Chapter 1, Section 1.1, "Language Processors," the text states, "a compiler is a program that can read a program in one language — the source language — and translate it into an equivalent program in another language — the target language... If the target program is an executable machine-language program, it can then be called by the user to process inputs and produce outputs." (pp. 1-2). This directly supports the function described in option A.
2. Patterson, D. A., & Hennessy, J. L. (2017). Computer Organization and Design RISC-V Edition: The Hardware Software Interface. Morgan Kaufmann.
Section 2.2, "Instructions: Language of the Computer," explains the compiler's role: "A compiler translates a high-level language program into an assembly language program," which is then assembled into a machine language object file. This process creates the basis for an executable program. (p. 64).
3. MIT OpenCourseWare. (2010). 6.035 Computer Language Engineering, Fall 2010. Massachusetts Institute of Technology.
In Lecture 1, "Introduction and Overview," slide 5 ("Compiler vs. Interpreter") explicitly differentiates the two: "Compiler: translates the entire source program to a target program, which is then executed. Interpreter: directly executes the source program." This confirms that option A describes a compiler and option B describes an interpreter.
Keep practicing
Take the free CYBERSECURITY-ARCHITECTURE-AND-ENGINEERING practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CYBERSECURITY-ARCHITECTURE-AND-ENGINEERING practice questions
- Question 1A cloud service provider is concerned about the potential risks associated with hardware-…
- Question 2While undergoing a security audit, it is determined that an organization has several back…
- Question 3The DevSecOps team for an organization manages a continuous integration and continuous de…
- Question 4Which security technique should be used to prevent data exfiltration?
- Question 5How can the organizational culture support ethical guidelines?
- Question 6An IT team must allow on-premises users to log in to the Azure portal using their corpora…
