Python - Programming Language
Python - Programming Language
1. What is a compiler?
Ans: A compiler translates the source code to target code. They translate a program written in a
high-level language into a low-level language all at once, in preparation for later execution.
2. What is an interpreter?
Ans: Execute a program in a high-level language by translating it one line at a time. Typically
generate an efficient intermediate representation and immediately evaluate it.
3. How is a compiler similar to an interpreter? How are they different?
Ans: Interpreters and compilers are very similar in structure. The main difference is that an
interpreter directly executes the instructions in the source programming language while a
compiler translates those instructions into efficient machine code.
4. How is compiled or interpreted code different from source code?
Ans: Source code is the text file that contains the program in some programming language
intended for consumption by humans. It cannot be executed natively by the computer’s CPU. It
has to be compiled or interpreted first, where compiled code is object code in either native CPU
instructions (like compiled C/C++ code) or some type of byte code that runs in a virtual machine
(like Java bytecode).
5. What tool does a programmer use to produce Python source code?
Ans: Programmers using tools such as editors, compilers, interpreters, debuggers, and profilers
to produce source code.
6. What is necessary to execute a Python program?
Ans: Typing commands directly in python shell (IDLE’s interactive shell) then enter the
program into IDLE’s editor, save it, and run it.
7. List several advantages developing software in a higher-level language has over developing
software in machine language.
Ans:
1. High level languages are programmer friendly. They are easy to write, debug and maintain.
2. It provide higher level of abstraction from machine languages.
3. It is machine independent language.
4. Easy to learn.
5. Less error prone, easy to find and debug errors.
6. High level programming results in better programming productivity.