/    /  Python – Interview Questions Part 2

1. What is the difference between NumPy and SciPy?

Answer: Lets see the difference between Numpy and scipy.

  1. NumPy considers only array data type and the most basic operations: indexing, sorting, reshaping, basic element wise functions et cetera.
  2. All numerical code would reside in SciPy. Hence, one of NumPy’s important goals is compatibility, so NumPy tries to retain all features supported by either of its predecessors.
  3. Thus NumPy contains some linear algebra functions, even though these more properly belong in SciPy.
  4. If in any case, SciPy contains more fully-featured versions of the linear algebra modules, as well as many other numerical algorithms.
  5. If you are doing scientific computing with python, you should probably install both NumPy and SciPy. Mostly have SciPy new features than NumPy.


2. What is TkInter?

Answer: TkInter is Python library, where it helps as a toolkit for GUI development and provides support for various GUI tools or widgets (such as buttons, labels, text boxes, radio buttons, etc) that are used in GUI applications. The common attributes of them include Dimensions, Colors, Fonts, Cursors, etc.


3. Does Python supports interfaces like in Java? Discuss.

Answer: Python does not provide interfaces like Java. (ABC) Abstract Base Class and its feature are provided by the Python’s “abc” module. ABC is a mechanism for specifying what methods must be implemented by its implementation subclasses. The use this feature provides a sort of “understanding” about methods and their expected behaviour. It is available from Python 2.7 version onwards.


4. How will you capitalize the first letter of string?

Answer: In Python, the capitalize() method capitalizes the first letter of a string. If a string already consists of a capital letter at the beginning, then, it returns to the original string.


5. How will you convert a string to all lowercase?

Answer: To convert a string to lowercase, lower() function can be used.




Output: xyz


6. Does Python have OOps concepts?

Answer: Python is an object-oriented programming language. This means that any program can be solved in python by creating an object model. Hence, Python can be treated as procedural as well as structural language.


7. What is Polymorphism in Python?

Answer: Polymorphism means the ability to take multiple forms.


8. How are Phon blocks defined ?

Answer: They are By indents or tabs. They are different from most other languages which use symbols to define blocks. Indents in Python are significant.


9. When would you use triple quotes as a delimiter ?

Answer: Triple quotes ‘’”” or ‘“are string delimiters that can span multiple lines in Python. These quotes are usually used when spanning multiple lines, or enclosing a string that has a mix of single and double quotes contained therein.


10. How to use GUI that comes with Python to test your code?

Answer: That is just an editor and a graphical version of the interactive shell.

1. In python You write or load code and run it, or type it into the shell.
2. There is no automated testing.