Python Interview questions
Python is a very popular language nowadays. As there is need of lots of Python developers in Future. Lots of freshers want to join Python companies. So, here are the major Python Interview Questions.
- What are the major data structures in python?
List, Dictionary, Set, and tuple are the major used data structures in Python. - What is Decorator in Python?Decorator in special kind of function that we use before executing other function. We can define our own logic in the decorator.
- What list comprehension in Python?List comprehension is special list property it allows the list to create a list on your own logic.
- What is lambda function in Python?Lambda function is a unique function in Python. Lambda function is a lightweight substitute of the small method. We can also call as the single line function.
- What is slicing in Python?Slicing is a special kind of mechanism in which we can select a particular part from String, List, tuple.
- What is docstring in Python?Python Program document string is also called as the docstring. We can Document the Functions, classes, and modules in Python.
- What is a negative index in Python?Python has a unique feature of indexing. we can define index in positive and negative. As an example, the positive index starts with 0 and negative index start with -1.
- What are the major frameworks used in Python?There are many frameworks available for web development but Django and Flask are the major frameworks we use. Flask is used in micro-projects and macro-projects.
- What is unittest in Python?unittest is a Python framework for unit testing. unittest is very versatile framework used for the module or unit testing.
- What is PEP-8?PEP-8 is coding convention that how to write effective and readable code.
- How to define a constructor in Python?In Python, there is special method to define the constructor in Python. we can define constructor by __init__(self) method.
- What is self in Python?self represents the instance of the class. By using the “self” keyword we can access the attributes and methods of the class in python.
That’s is from my side this is part-1 python interview questions. Will bring you more questions in part two.
No comments: