Top 10 Python Interview Question

1) What is python?
- Python was created by Guido van Rossum in 1991- Web applications are made by python with the help of servers.
- Python handles huge amount of data & perform and mathematics.
- Python works on different platform like Mac, Linux, Windows, Raspberry Pi etc). ·
- Python is a object oriented programming language.
- Python is high level & most popular programming language.
2) Is the python case sensitive language.
- Yes, Python is a case sensitive language. Because it differentiates the lower case & upper case identifiers.3) What is Lambda function in python?
- Lambda function in python having no name.- Lambda forms are utilized to construct anonymous Fuctions.
- A normal functions are defined by def keyword but unnamed functions defined by lambda keyword.
Example:
adder = lambda x, y: x + y
- Python is object oriented programming language.
- In python there are Tuple, list and dictionary are useful data structure is present in the language.
- Python runs on various platform like Mac, windows, Linux, raspberry pi etc.
- Python is free and open source language.
- It provides a very readable and eye-pleasing coding style.
- A full form of PEP is Python Enhancement Proposal.
- PEP 8 recommends use 4 spaces to show indentation and tabs should only be used to maintain consistency in the program.
- The self keyword is used to represent the instance of the class.
- The self variable in the init method refer to the newly created object while in other methods.
- Self is also used to refer to a variable field within the class.
- A normal functions are defined by def keyword but unnamed functions defined by lambda keyword.
Example:
adder = lambda x, y: x + y
print (adder (4, 8)).
4) What are the advantages of Python?
- Python is very flexible & extensible language.- Python is object oriented programming language.
- In python there are Tuple, list and dictionary are useful data structure is present in the language.
- Python runs on various platform like Mac, windows, Linux, raspberry pi etc.
- Python is free and open source language.
5) What is PEP 8?
- In python PEP 8 has appears as the style. guide that most projects hold to it.- It provides a very readable and eye-pleasing coding style.
- A full form of PEP is Python Enhancement Proposal.
- PEP 8 recommends use 4 spaces to show indentation and tabs should only be used to maintain consistency in the program.
6) What is self in python?
- By using self keyword we can access the attribute & methods of class in python.- The self keyword is used to represent the instance of the class.
- The self variable in the init method refer to the newly created object while in other methods.
- Self is also used to refer to a variable field within the class.
7) What is Init function in python?
- _init_ is one of the reserved method in Python.
- The _init_ method can be called when an object is created from the class.
- All classes have a function called _init_(), which is always executed when the class is being initiated.
- Use the _init_() function to assign values to object properties.
- The _init_ method doesn't create the object but only initialize the object's attributes.
8) What is pass in Python?
- The pass keyword represents a null operation in python.
- It is generally used for the purpose of filling up empty block of code which may execute during runtime.
- The pass statement is generally used as a placeholder.
- The pass statement is useful when write implementation of function.
9) What is slice function in python.
- Python slice() function is used to get a slice of elements from collection of elements.
- slice() function used with string, list, tuple, set, bytes or range objects.
- Syntax : slice (stop)
slice (start, stop, step)
10) How is memory managed in python?
- Memory management in python involves a private heap containing all python objects & data structure.
- The python memory manager is deals with storage management aspects, like sharing segmentation and caching.
- The core API gives access to some tools for programmer to code.
- In python there is also garbage collection is present. It recycles all the unused memory and so it makes free space in memory.
Read Also : Introduction To Programming Language