SCRIPTING-AND-PROGRAMMING-FOUNDATIONS practice question 11 of 25

Which statement describes a compiled language?

Full set: 137 questions
Answer options
A: It is considered fairly safe because it forces the programmer lo declare all variable types ahead of time and commit to those types during runtime.
B: It allows variables to change from the initial declared types during program execution.
C: It specifies a series of well-structured steps to compose a program.
D: It has code that is first converted to machine code, which can then only run on a particular type of machine. Correct answer
Correct Answer:
D. It has code that is first converted to machine code, which can then only run on a particular type of machine.
Explanation

A key characteristic of a compiled language is that the compiler translates the source code into machine code tailored for a specific computer architecture (e.g., x86-64, ARM). This resulting executable file is not portable and can only be run on systems with the same architecture for which it was compiled. To run the program on a different type of machine, the original source code must be re-compiled using a compiler that targets the new architecture.

Why Incorrect

A. This describes static typing. While many compiled languages are statically typed, it is a feature of the type system, not a universal rule for all compiled languages.
B. This describes dynamic typing, a feature more commonly associated with interpreted languages like Python and JavaScript, not compiled languages.
C. This describes the procedural programming paradigm, which is a way of structuring code and is independent of whether the language is compiled or interpreted.

References

1. Patterson, D. A., & Hennessy, J. L. (2017). Computer Organization and Design: The Hardware/Software Interface (5th ed.). Morgan Kaufmann. Chapter 2, Section 2.3, "Compiling a C Program," details how a C compiler generates an object file with machine language instructions specific to the target processor.

2. University of Washington. (n.d.). CSE 373: Data Structures and Algorithms, Lecture 1: Introduction; ADTs; Stacks. The lecture notes differentiate compiled languages by stating the "compiler translates source to machine code for a specific platform."

3. Guttag, J. V. (2016). Introduction to Computation and Programming Using Python: With Application to Understanding Data (2nd ed.). MIT Press. Chapter 2 explains that compiled code is "translated into machine language," which is inherently specific to the machine's processor.

Scroll to Top