Subdomain 1.1: Understand fundamental terms and definitions
1.Which term best describes the process by which Python executes code?
- A.Interpretation
- B.Compilation
- C.Just-in-time compilation
- D.Bytecode interpretation
Show answer & explanation
Correct answer: D — Bytecode interpretation
- A. While Python is often called an interpreted language, general interpretation typically means executing source code line by line without an intermediate representation. Python actually compiles source code to bytecode first, so this term alone is imprecise for the standard implementation.
- B. Compilation is the process of translating source code into another form, such as bytecode or machine code. Python does compile source code to bytecode, but this is only one step; the bytecode is then interpreted by the Python Virtual Machine. Thus, 'compilation' alone does not fully describe Python's execution model.
- C. Just-in-time (JIT) compilation compiles code during execution, often for performance. Standard CPython does not use JIT compilation; it relies on bytecode interpretation. JIT is used in some alternative Python implementations like PyPy, but not in the default one.
- D. Correct. Python's standard execution model involves compiling source code into bytecode (.pyc files) and then interpreting that bytecode using the Python Virtual Machine (PVM). This two-step process is commonly referred to as bytecode interpretation, which accurately describes how Python runs code.