Python Interview Questions and Answers
Python is an object-oriented, high level language, interpreted, dynamic and multipurpose programming language.
Python is easy to learn yet powerful and versatile scripting language which makes it attractive for Application Development.
Python's syntax and dynamic typing with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas.
Python supports multiple programming pattern, including object oriented programming, imperative and functional programming or procedural styles.
Python is not intended to work on special area such as web programming. That is why it is known as multipurpose because it can be used with web, enterprise, 3D CAD etc
Python is created by Guido van Rossum and the first released in 20 February 1991; around 26 years ago.
What Are the key features of Python?
Some features of Python are -
ü Python supports OOPs
ü Python supports a style of programming called functional programming.
ü Python supports structured programming methods
ü Python used scripting language
ü Python provides very high-level dynamic data types
ü Python supports dynamic type checking
ü Python supports garbage collection
Is Python Object Oriented?
Yes! Python is an object oriented programming.
Is Python a Case Sensitive Language?
Yes! Python is a case sensitive programming language.
How Python is interpreted?
As you know, Python is an interpreted language and its program runs directly from the source code and the source code converts into an intermediate language. The intermediate language converts into machine language that has to be executed.
Which Python library is used for Machine Learning?
The Python growing adoption in data science and For Machine Learning Python used to SciKit-Learn library.
What Is Namespace in Python?
In Python programming, all name introduced has a place where it lives and can be hooked for that is called namespace.
How to overload constructors or methods in Python?
The Python constructor – _init__ () is a first method of a class. When you try to instantiate an object __init__() is automatically invoked by Python to initialize members of an object.
How Are the differences in help () and dir () functions?
The help () function - This function is used to display the documentation string and also helps for related to modules, keywords, attributes.
The dir () function - This function is used to display the defined symbols. It's only display the defined symbols.
What Are the differences in deep and shallow copy?
The shallow copy - This function is used when a new instance type gets created and also keeps the values that are copied in the new instance.
The Deep copy - This function is used to store the values that are already copied. It doesn’t copy the reference pointers to the objects.
What Are the differences in list and tuple?
The main difference is –
The list is mutable while tuple is not that means tuple is immutable.
How ternary operators be used in Python?
The Ternary operator is special kinds of operator which used to show the conditional statements and these conditional statements will return true or false.
What Are the supported data types in Python?
Python has five standard data types which are -
ü Numbers
ü String
ü Tuple
ü List
ü Dictionary
What Is Tuples in Python? How differ with Lists?
The Tuple is another sequence data type and it’s similar to list.
The Tuples are enclosed in parentheses ( ( ) ) and their elements and size can’t be updated. Tuples can be thought of as read-only lists.
The Lists are enclosed in brackets ( [ ] ) and their elements and size can be changed.
What Is built-in type in Python?
Python provides mutable and Immutable types -
The Mutable built-in types-
ü List
ü Dictionaries
ü Sets
The Immutable built-in types -
ü Strings
ü Numbers
ü Tuples
0 comments:
Post a Comment