CompTIA Tech+ (FC0-U71)Software Development ConceptsMedium
A junior developer is confused about the difference between compiled and interpreted programming languages. Which of the following statements accurately describes a key characteristic of compiled languages?
- AErrors are usually detected only during runtime execution.
- BSource code is translated into machine code before execution.
- CCode is executed line by line by an interpreter at runtime.
- DPrograms are typically platform-independent due to runtime interpretation.
Show answer & explanationAnswer & explanation
Correct answer: B. Source code is translated into machine code before execution.
Compiled languages translate the entire source code into machine-executable code (an executable file) before the program runs. This pre-compilation step allows for early error detection and generally results in faster execution.
Why the other options are wrong
- A. Compiled languages detect most syntax and type errors during the compilation phase, before runtime.
- C. This describes an interpreted language, not a compiled one.
- D. Interpreted languages are often more platform-independent; compiled languages typically produce platform-specific executables.
Compiled Language
A type of programming language where the source code is translated directly into machine code (or an intermediate bytecode) by a compiler before the program is executed. The resulting executable file can then be run independently.
- Requires a compilation step before execution.
- Results in faster execution speeds because code is pre-translated.
- Errors are largely detected during compilation (compile-time errors).
- Executables are typically platform-specific (e.g., Windows .exe, Linux ELF).
Memory trick: Compiled: 'Compile' it once, then 'run' it fast.