In: Computer Science
11. What is the difference between Interpreted and Compiled program languages? Describe
briefly the advantages and disadvantages between these two categories of language. Under
which category the language Python falls?
12. What is an identifier? List the rules for writing identifiers in Python language.
13. What is a Python statement? Give examples of different ways you can write multiline
statements. Explain, with examples, the use of indentation in Python language.
14. How do you write comments in Python? How many different ways you can write multiline
comments? Give examples of each.
15. Explain, with an example, the use of Docstring in Python. Can you define a Docstring
anywhere in a module?
16. What do you mean by a variable in programming context? Do you need to declare variables
in Python before you can use it?
17. Define a constant in Python programming context. Explain, with an example, where usually
you store constants and how you use them whenever you need them.
18. What is a literal in Python? Give examples of different types of literals used in Python
language. How many special literals Python offers? Explain, with an example, how to use
special literal in Python.
19. List Python data types.
20. Explain, with examples of each, the differences among different data types available in
Python language. Explain, with examples, how many different ways Python handles type
conversion
Solution 11 :
Interpreter : Interpreter translates single statement of source code into machine code at a time.
Compiler : Compiler translates all statements of source code into machine code as a whole.
Advantages and Disadvantages of Interpreter | Advantages and Disadvantages of Compiler |
It is memory efficient as there is no intermediate object code generated in this. | As we know that while compiling , it needs linking. So , while linking , it produces intermediate object code which consumes memory. Hence , we can say that it is not memory efficient. |
Debugging is very easy while interpreting because it stops its translation ( from source code into machine code ) whenever it finds even a single error. | Debugging is very hard while compiling because it stops after complete translation ( from source code into machine code ) only and then shows all errors. |
Programming languages like Python, JavaScript and Ruby uses interpreters. | Programming language like C and C++ uses compilers. |