PCEP-30-02 · Question #127
The pyc file contains ...
The correct answer is C. compiled Python bytecode. When Python runs a .py file, it first compiles the source code into bytecode - a lower-level, platform-independent representation - and caches it in a .pyc file so subsequent runs can skip the compilation step and load faster. This is why C is correct: .pyc files store compiled…
Question
Options
- Aa Python interpreter.
- BPython source code.
- Ccompiled Python bytecode.
- Da Python compiler.
How the community answered
(47 responses)- A4% (2)
- B6% (3)
- C77% (36)
- D13% (6)
Explanation
When Python runs a .py file, it first compiles the source code into bytecode - a lower-level, platform-independent representation - and caches it in a .pyc file so subsequent runs can skip the compilation step and load faster. This is why C is correct: .pyc files store compiled Python bytecode, not raw source.
Why the distractors are wrong:
- A (interpreter): CPython (the interpreter) is a separate executable (
python.exe/python3), not stored in.pycfiles. - B (source code): Source code lives in
.pyfiles;.pycis the compiled output of that source. - D (compiler): The compiler is part of the Python runtime itself, not packaged into
.pycfiles.
Memory tip: Think of .pyc as "Python compiled" - the c suffix literally stands for compiled bytecode, just like how C compilers produce .o object files from .c source files.
Community Discussion
No community discussion yet for this question.