Python Interview Questions & Answers - Part 3


  • Team myQ

    9) How are arguments passed by value or by reference?
    Everything in Python is an object and all variables hold references to the objects. The references values are according to the functions; as a result you cannot change the value of the references. However, you can change the objects if it is mutable.

    10) What is Dict and List comprehensions are?
    They are syntax constructions to ease the creation of a Dictionary or List based on existing iterable.

    11) What are the built-in type does python provides?
    There are mutable and Immutable types of Pythons built in types
    Mutable built-in types

    • List
    • Sets
    • Dictionaries

    Immutable built-in types

    • Strings
    • Tuples
    • Numbers

    12) What is namespace in Python?
    In Python, every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where a variable name is mapped to the object placed. Whenever the variable is searched out, this box will be searched, to get corresponding object.