Python MCQ Questions and Answers on Compiling and Running Programs

Study and learn Interview MCQ Questions and Answers on Compiling and Running Python Programs. Attend job interviews easily with these Multiple Choice Questions. You can print these Questions in default mode to conduct exams directly. You can download these MCQs in PDF format by Choosing Print Option first and Save as PDF option next using any Web Browser.

Go through Python Theory Notes on Compiling Running and Python Theory Notes on Byte Code before reading these objective questions.



1) A python program can be compiled and run separately. State TRUE or FALSE.
A) FALSE
B) TRUE
C) -
D) -
Answer [=]
A
Explanation: A python program can be compiled and run using a single command that is "PYTHON" itself.
2) Which is the command used to compile a Python program?
A) py
B) python
C) pythonc
D) None of the above
Answer [=]
B
Explanation: PYTHON command can compile python programs.
3) Which is the command used to run a Python program?
A) python
B) py
C) pythonr
D) pythonrun
Answer [=]
A
Explanation: The same PYTHON command compiles and runs a python program.
4) Which is the python command that displays the output of a Python program?
A) pythonshow
B) pythonrun
C) pythondisplay
D) python
Answer [=]
D
Explanation: Here running a program is nothing but displaying the output. So the same "PYTHON" command displays the output after compiling and running.
5) What are the two ways of compiling or running a Python program?
A) Using CMD (Command Prompt Windows / MAC)
B) Python Shell
C) Both A and B
D) None of the above
Answer [=]
C
6) A python program is converted into ______ code after compilation.
A) Cheat Code
B) Short Code
C) Byte Code
D) Nano Code
Answer [=]
C
Explanation: Byte is the outcome of compiling a Python program.
7) Which are the programming languages that when compiled produces Byte code?
A) Java
B) Python
C) PHP
D) All the above
Answer [=]
D
Explanation: Some other programming languages producing Byte code are Scala, Kotlin, Groovy etc


8) What does IDLE in "Python IDLE" in represent?
A) Integrated Development Environment
B) Integrated Development Learning Environment
C) Integrated Development Like Environment
D) Integrated Developer Lead Environment
Answer [=]
B
9) What is PVM?
A) Python Virtual Machine
B) Python Variable Model
C) Python Vernacular Machine
D) Python VRAM Machine
Answer [=]
A
10) The Byte Code produced after compiling a Python program is run inside ________.
A) Python Virtual Machine
B) Java Virtual Machine
C) DRAM
D) Static RAM
Answer [=]
A
11) A Python Virtual Machine is generally a ______________.
A) Confined Memory to safely run a Python program's Byte code
B) Interpreter that runs the byte code line by line
C) Byte code to Machine code converter
D) All the above
Answer [=]
D
12) Which is the symbol that is displayed in the Python Shell prompt?
A) >>
B) >>>
C) :
D) :>
Answer [=]
B
Explanation: You can type the short python code next to the ">>>" symbol. Output is displayed immediately.
13) What is the output of the below code snippet?
>>>print('Starting the car..')
A) Compiler error
B) print('Starting the car..')
C) Starting the car..
D) None of the above
Answer [=]
C
Explanation: PRINT statement prints whatever is inside the opening and closing parantheses.
14) The PVM (Python Virtual Machine) is implemented as a _______________
A) Heap
B) Stack
C) Both A and B
D) None of the above
Answer [=]
B
Explanation: PVM is like a Stack memory.


15) Which is the part of PVM that reclaims or releases memory that is not being referenced by any variable?
A) Memory Collector
B) Garbage Bag
C) Garbage Collector
D) Recyclebin
Answer [=]
C
Explanation: Garbage collector is the one that releases or reclaims memory that is not being used by any code.