Top Python Interview Questions

Larry Martell larry.martell at gmail.com
Fri May 26 18:56:45 EDT 2017


On Fri, May 26, 2017 at 1:03 AM, Aarusha <mrdinfonet1 at gmail.com> wrote:
> PYTHON INTERVIEW QUESTIONS
>
> Mindmajix has compiled Python Interview questions which would benefit the learners to attend the Python interviews.
>
> Q. How is Python executed?
>
> Python files are compiled to bytecode. which is then executed by the host.
> Alternate Answer:
> Type python <sourcefile>.pv at the command line.
>
> Q. What is the difference between .py and .pyc files?
>
> .py files are Python source files. .pyc files are the compiled bvtecode files that is generated by the Python compiler
>
> Q. How do you invoke the Python interpreter for interactive use?
>
> python or pythonx.y where x.y are the version of the Python interpreter desired.

While knowing these may mean you are a good python programmer, not
know them does not mean you are not.

When I am interviewing someone I like to ask them to write a very
simple program, e.g. calculate the sum of the squares and the square
of the sum of the numbers from 1 to 10. From this I can tell how
comfortable they are with python.

If they write a loop with range(1,10) they are going in the 'no' pile.
If they write a loop with range(1,11) they go in the maybe pile
If the write sum([i*i for i in range(1,11)]) and sqrt(sum([i for i in
range(1,11)])) they are going in the yes pile.

Another thing I ask is how they debug. If they say: python -m pdb that
gets them a lot of points with me.



More information about the Python-list mailing list