JN0-223 practice question 11 of 15
What is the correct sequence for Python script execution?
Full set: 66 questionsThe standard Python (CPython) execution model follows a specific sequence. First, the Python interpreter reads and parses the source code (.py file). This initial stage can be broadly termed "interpretation." During this phase, the interpreter translates the human-readable source code into an intermediate, low-level representation called "bytecode." This bytecode is then passed to the Python Virtual Machine (PVM), which executes it at runtime. This hybrid approach combines compilation to an intermediate form with interpretation of that form, providing both portability and performance benefits.
A. This sequence is incorrect. Interpretation of the source code is the initial step, not the final one that occurs after runtime execution.
C. This is incorrect. The translation to bytecode is a core part of the overall interpretation process, not a step that happens before it.
D. This is incorrect. Execution is the final stage. The code must be interpreted and translated to bytecode before it can be executed.
1. Official Python Documentation
Glossary:
Interpreter: "The program that reads and executes Python code. It has two parts: a compiler that translates the source code into an intermediate code called bytecode
and a virtual machine that executes the bytecode." This confirms that translation to bytecode is part of the interpreter's process before the virtual machine executes it.
Bytecode: "Python source code is compiled into bytecode... This bytecode is then executed by the Python virtual machine." This establishes the sequence of compilation to bytecode
followed by execution.
Source: Python Software Foundation. (2024). Glossary. Python 3.12.3 documentation. Retrieved from https://docs.python.org/3/glossary.html#term-interpreter
2. Official Python Documentation
FAQ:
Section: "Is Python an interpreted or a compiled language?"
Content: "Python is an interpreted language
as opposed to a compiled one
though the distinction can be blurry because of the presence of the bytecode compiler. This means that source files can be run directly without explicitly creating an executable... Python source code is always compiled into bytecode
and this bytecode is then executed by the Python Virtual Machine (PVM)." This source clarifies the compile-to-bytecode step happens first
followed by execution.
Source: Python Software Foundation. (2024). Frequently Asked Questions. Python 3.12.3 documentation. Retrieved from https://docs.python.org/3/faq/general.html#is-python-a-compiled-or-an-interpreted-language
3. MIT OpenCourseWare
6.0001 Introduction to Computer Science and Programming in Python
Fall 2016:
Section: Lecture 2 Notes
"Kinds of languages"
Content: "Python uses a hybrid approach. It compiles source code to a bytecode. This bytecode is then interpreted by a virtual machine." This academic source validates the sequence where source code is first compiled to bytecode
which is then interpreted/executed.
Source: Guttag
J. (2016). Lecture 2: Branching
Conditionals
and Iteration. MIT OpenCourseWare
6.0001 Introduction to Computer Science and Programming in Python. Retrieved from https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/lec2/
Keep practicing
Take the free JN0-223 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other JN0-223 practice questions
- Question 1Which two programming languages have a NETCONF library supported by Juniper Networks? (Ch…
- Question 2A REST API client uses which two HTTP methods to execute RPC requests on the server? (Cho…
- Question 3Which statement is valid regarding YAML and JSON?
- Question 4Which two statements about the REST API are correct? (Choose two.)
- Question 5Which development model is the classic approach to software development?
- Question 6Which statement is correct about DevOps?
