MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Fundamental Programming
Translation & Execution
Beginner
Q
How does the standard CPython implementation run a .py file?
AIt compiles the source to bytecode, which the Python virtual machine then executes
BIt compiles the source directly to native machine code
CIt interprets raw source text line by line with no compilation step
DIt converts the code to Java bytecode and runs it on the JVM
Correct Answer:
A. It compiles the source to bytecode, which the Python virtual machine then executes
Explanation:
A common misconception is that Python has no compilation step. CPython compiles to bytecode (.pyc), which the PVM interprets.
ALSO KNOW (related points):
• What does a JIT (Just-In-Time) compiler do? → It compiles intermediate code (such as bytecode) into native machine code while the program is running
• In standard C++, what happens when an integer is divided by zero (int x = 5 / y; with y == 0)? → Undefined behavior: the standard does not guarantee any exception
• Which statement about compiled and interpreted languages is most accurate? → 'Compiled' and 'interpreted' describe implementations, not languages; the same language can have both kinds of implementation