Compiled vs. Interpreted Languages: Execution Models

200-901 By islever Editorial Last updated

Compare data formats (XML, JSON, and YAML) Describe parsing of common data format (XML, JSON, and YAML) to Python data structures

Short answer

B Compiled languages translate to machine code before execution, while interpreted languages execute line-by-line at runtime.

Question

What is the difference between a compiled language and an interpreted language?
  1. Compiled languages are faster; interpreted languages are more secure.
  2. Compiled languages are translated to machine code before execution; interpreted languages are executed line-by-line at runtime. Correct Answer
  3. Compiled languages require a virtual machine; interpreted languages do not.
  4. There is no difference; the terms are interchangeable.

Key Takeaways

This question distinguishes between compiled and interpreted languages based on their execution models. Option B is correct because it accurately describes how compiled languages are translated to machine code prior to execution, whereas interpreted languages are processed line-by-line during runtime.

Expert Analysis

Compiled languages (C, Go) are translated to machine code by a compiler before execution. Interpreted languages (Python, JavaScript) are executed line-by-line by an interpreter at runtime, which generally makes them more flexible but slower.

The distinction between compiled and interpreted languages is foundational to understanding software development workflows, particularly in the context of Cisco platforms where both Python scripting and low-level network device programming coexist. Option B correctly identifies the core mechanism: compilation translates source code into machine code prior to execution, whereas interpretation involves executing instructions line-by-line or statement-by-statement during runtime. This difference dictates performance characteristics, portability, and debugging strategies.

Option A is incorrect because speed is not the sole defining factor; while compiled languages often run faster due to direct machine code execution, interpreted languages can be optimized with just-in-time (JIT) compilers or C-extensions (as seen in Python's NumPy). Furthermore, security is not inherently tied to the compilation model; interpreted languages can be equally secure if properly implemented. The claim that interpreted languages are "more secure" is a misconception that ignores vulnerabilities specific to runtime environments.

Option C is incorrect because it reverses the typical association. It is interpreted languages (like Java or C#) that often require a virtual machine (JVM or CLR) to abstract away hardware differences. Compiled languages like C or Go produce native binaries that execute directly on the operating system without an intermediate VM layer, although some compiled languages may use lightweight runtimes. The defining feature is the translation timing, not the presence of a VM.

Option D is factually wrong; the terms are not interchangeable. They represent fundamentally different approaches to code execution. Understanding this distinction is critical for developers working with Cisco technologies, as IOS XE scripts might be interpreted via Python, while control plane protocols might involve compiled C code for performance-critical operations.

In the context of the 200-901 exam, this question tests basic computer science concepts applicable to automation and scripting. Candidates must recognize that Python, a primary tool for Cisco DevNet and automation, is an interpreted language. This impacts how scripts are deployed: they require a Python interpreter on the target device or server. In contrast, tools like Go (used in some modern Cisco utilities) are compiled, producing standalone executables that do not depend on a runtime environment being present on the host. This affects deployment strategies, such as whether to ship source code or binary files. The key takeaway is the timing of translation: pre-execution for compiled, runtime for interpreted. This influences error detection (compile-time vs. runtime errors), performance overhead, and cross-platform compatibility. For instance, a compiled program written for Linux will not run on Windows without recompilation, while an interpreted script might run on any OS with the correct interpreter installed. Understanding this helps candidates choose the right tool for the job: compiled for high-performance, embedded scenarios; interpreted for rapid development, scripting, and flexibility.

Exam Strategy

When facing questions about programming language types, focus on the timing of translation relative to execution. If the code is converted to machine code first, it's compiled. If it's executed directly by an interpreter during runtime, it's interpreted. Remember that Python is interpreted, while C/Go are typically compiled. This distinction helps determine deployment requirements (e.g., needing an interpreter vs. a binary).

Practice All 200-901 Questions

Access 105 questions with complete answers and detailed explanations.

View Full 200-901 Practice Test →

← Back to 200-901 Study Guide