re: 10 Python Interview Questions and Answers for Freshers VIEW POST


1. To say

Python is Interpreted Language while Java is compiled language

is over simplification and not fully true.

First of all, if we define compiled languages those languages which translate high-level code to machine code (like C/C++), neither Java nor Python are compiled languages, since they translate (compile) high level code to bytecode, which, later, can be both compiled or interpreted to machine code. Furthermore, today the famous implementations of both languages use a technique called Just-in-time compiling (JIT).

So, when you say Java is compiled language, you cannot say that python is interpreted and vise-versa. Those languages can both be compiled and interpreted.

2. When you compare arrays and lists, again there is a problem with definitions.

Python has a builtin data type list, but it doesn't have array data type, so when you compare, you have to indicate what do you mean by saying list and what do you mean by saying array. This is necessary, because list has a lot different meaning in computer science than it does in python. In CS we refer to lists as linked lists. In python, list is more similar to dynamic arrays (or vectors in C++ stl, with a difference that in python a list can contain objects of different types) than to linked lists (at least in CPython).

So, if you get a question like this during the interview, you need to clarify what they mean:

  • CS: linked list vs array?
  • Python list vs array from a library (eg NumPy.array())
  • etc

Thanks for the comment I have updated the question, it referred to the array of C language.
Sorry for the confusion created.

code of conduct - report abuse