PYTHON Programming Interview Questions [23 Questions]

  1. Python PopularityWhy Python is not that much of popular, when compared to other programming languages?
  2. What is __slots__ and when is it useful?Normally, all class objects have an __dict__ which allows new attributes to be bound to a class instance at runtime. When a class is defined with __slots__, only attributes whose names are present in the __slots__ sequence are allowed. This results in instances of this class not having an __dict__ attribute and not being able to bind new attributes at run time.

    __slots__ is useful because it eliminates the memory overhead of a python dictionary, while still allowing you to use a structured class. When dealing with a large number of class objects, the memory savings can be quite dramatic.
  3. What is the optional statement used in a try ... except statement in Python?
  4. What is used to create Unicode string in Python?
  5. What is List Comprehensions feature of Python used for?
  6. You must first Login or Register to view all 23 questions from this category.

    Registering yourself is FREE, takes just less than a minute and opens up a whole new GetGyan experience.