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

What is a feature of CM as a programming language

Full set: 137 questions
Answer options
A: The code must be compiled into machine code in the form of an executable file before execution. Correct answer
B: The program usually runs slower than an interpreted language.
C: The code runs directly one statement at a time by another program called a compiler
D: The code does not require being translated into machine code but can be run by a separate program called a compiler.
Correct Answer:
A. The code must be compiled into machine code in the form of an executable file before execution.
Explanation

A compiled language is one where the source code is translated into machine code by a program called a compiler. This process creates a standalone executable file that can be run directly by the computer's processor. This pre-execution translation is the defining characteristic of compiled languages and is a primary reason for their typically high execution speed compared to interpreted languages.

Why Incorrect

B. This is incorrect. Compiled programs generally run faster than interpreted ones because the translation to machine code happens only once, before execution.
C. This describes an interpreted language, not a compiled one. An interpreter, not a compiler, executes code one statement at a time.
D. This statement is contradictory. Compiled languages do require translation into machine code, and the program that performs this is the compiler, which does not run the code itself.

References

1. Aho, A. V., Lam, M. S., Sethi, R., & Ullman, J. D. (2007). Compilers: Principles, Techniques, & Tools (2nd ed.). Pearson/Addison Wesley. Chapter 1, Section 1.1.1 "Language Processors," describes a compiler as a program that "translates a program written in a source language into an equivalent program in a target language," where the target is often machine code.

2. Harvard University. (n.d.). CS50: Introduction to Computer Science. Week 1, C. The course material explains that a compiler (like Clang) takes source code (e.g., hello.c) and converts it into machine code (an executable file like a.out).

3. The Go Programming Language Documentation. (n.d.). How to Write Go Code. Retrieved from go.dev. Section "Compile and run your code." The documentation states, "The go build command compiles the packages... The result is an executable file."

Scroll to Top