0% found this document useful (0 votes)
136 views

Python Interview Questions - CodeWithCurious

Uploaded by

Peter Parker
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views

Python Interview Questions - CodeWithCurious

Uploaded by

Peter Parker
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

06/12/2022, 17:12 Python interview Questions - CodeWithCurious

Python Interview Questions


1. Define Python?

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed
to be highly readable. It uses English keywords frequently where as other languages use punctuation and
it has fewer syntactical constructions than other languages.

2. Why Did You Prefer Python Than Java?

Both Python and Java are most popular language. Even though Java is faster than python as a beginner I
need to opt for the one which is easier to learn and like java python can be used everywhere now a days
which included Data Science, Machine Learning Applications and AI related Applications because it has
over 3 million pre-defined packages which makes implementation easier.

3. What Are Keywords In Python? Define Any 5 Among Them?

Like in other programming languages keywords are nothing but the reserved words which are meant for
some specific functionalities when they are used in python programs. In python there are 32 keywords
some of them are

for,while – used to iterations

in – used to check the existence of subsequence or substring in a collection or string respectively.

return – used to return something from a functions

lambda – used to define an anonymous function in python

Ads by
Send feedback Why this ad?
Speed up checkout
Improve accuracy for billing, shipping, and de
site

Google Maps Platform

def – used to define the functions in python

*All the keywords in python are written in lowercase

4. Basic Data Types in Python?

As the python is dynamically typed language there is no need to define the type of variable, we can simply
assign the values to it and the basic data types include Integer, Float, Boolean, String

5. The Term Namespace In Python Refers To?

A namespace in python usually refers to the technique for ensuring all the names in the program are
unique and distinct to each and every object in the program.

6. Explain Docstring In Python.

The DocString in an acronym for Document String which is used to documentation for the code written in
python program. The docstring in python starts and ends with triple quotes(“”” or ‘’’).

https://codewithcurious.com/python-interview-questions/ 1/3
06/12/2022, 17:12 Python interview Questions - CodeWithCurious
7. Functions And It’s Types In Python

 in python. There
The functions in python are used for code reusability. They are define using def keyword
are three types of functions Built-In Functions, User Defined Functions and lambda Functions.

8. What Are The Different Type Of Arguments We Can Pass To Function In Python?

In general, the arguments are the actual values we pass to function during function call. There are four
types of arguments that can be passed to functions in python they are

-> Default Arguments

-> Keyword Arguments

-> Positional Arguments

-> Variable Length Arguments

9. What Is The Difference Between Function And Module In Python?

Both functions and modules are similar to each other where the functions are used to define only to
obtain some specific functionality but module define can contain functions along with classes and
attributes.

10. What Is The Difference Between Package And Module In Python?

Package is a collection of modules where they are used to reduce code redundancy by simply importing
them into our program and using the modules or classes which are predefined in it. Whereas modules are
defined as the collection of functions along with classes and their attributes.

11. Collections in Python

Collections in python are used to store collection/ group of elements under a single variable. The
collection in python includes List, Tuples, Set and Dictionary.

12. Define Generators And Their Use In Python?

Generators functions are the special functions in python. When one want to return an iterators or a group
of statements he uses yield keyword instead of return keyword. The generator functions are defined using
syntax function* function_name.

13. Define class and Object. Implement them using python?

Class is defined as user defined data structure where it holds the data members and member functions of
the instance we want to create. Simply class is defined as the blueprint of an object and object is real
world entity where we will work on the instance, we created using this object.

14. Explain OOPS Concepts Available In Python?

The OOPS concept in python include

Inheritance – The process of inheriting properties of parent class to base class

Encapsulation – The process of binding data members and member functions of a class

Polymorphism – Simply function with same name but with different attributes

Data Abstraction – Hiding the sensitive code from others this can be achieved by creating abstract classes
in python

15. Use Of Self Keyword In Python.

The self keyword is used in classes to ensure that the defined method is current instance of the class and
the variables defined with self keyword ensures that they belong to current instance and can be
accessible when we create objects to that class.

https://codewithcurious.com/python-interview-questions/ 2/3
06/12/2022, 17:12 Python interview Questions - CodeWithCurious

Info

 Home

 Projects

 E books

 Blogs

 About Us

Support

 Contact us
 Privacy Policy

Follow Us For More!


   

© 2021 All Rights Reserved CodeWithCurious

Back To Top

Ads by
Send feedback Why this ad?

Give real-time directions


Find the fastest route between two points for everyone on your p

Google Maps Platform Lear

https://codewithcurious.com/python-interview-questions/ 3/3

You might also like