P Y T H O N I N T E R V I E W
Q U E S T I O N S
W W W . P R O B Y T E S . N E T
1. What is Python?
P y t h o n i s a g e n e r a l - p u r p o s e
p r o g r a m m i n g l a n g u a g e w h i c h i s o b j e c t -
o r i e n t e d a n d h i g h - l e v e l p r o g r a m m i n g
m a i n l y u s e d f o r w e b a p p l i c a t i o n s a n d
d e v e l o p m e n t .
2. What are the features Python can offer? 
P y t h o n c a n b e u s e d t o c r e a t e s o f t w a r e ,
g a m e s a n d w e b a p p l i c a t i o n u s i n g s e v e r a l
f r a m e w o r k s .
3. Can you compare Java and Python? 
Y e s , t h e b i g g e s t d i f f e r e n c e b e t w e e n J a v a
a n d P y t h o n , P y t h o n i s e a s i e r a n d s i m p l e r
w h e r e a s J a v a u s e s m o r e c o m p l e x c o d e s .
4. Is Python an interpreted language? 
Y e s , P y t h o n h a s i n t e r p r e t e d l a n g u a g e
b e c a u s e P y t h o n p r o g r a m s r u n d i r e c t l y
f r o m t h e s o u r c e c o d e .
5. Who was the founder of Python and when was it
released? 
G u i d o V a n R o s s u m h a s f o u n d e d t h e
P y t h o n a n d i t w a s r e l e a s e d i n D e c e m b e r
1 9 8 9 .
6. Name any programming paradigms which
Python include? 
O b j e c t - o r i e n t e d , i m p e r a t i v e , f u n c t i o n a l
a n d p r o c e d u r a l a r e t h e p r o g r a m m i n g
p a r a d i g m s w h i c h P y t h o n i n c l u d e .
7. Why is Python said to be a High-Level
Programming Language? 
P y t h o n i s s a i d t o b e H i g h - L e v e l
P r o g r a m m i n g l a n g u a g e b e c a u s e t h e
l a n g u a g e w h i c h P y t h o n u s e s i s c l o s e r t o
h u m a n l a n g u a g e s t h u s w h i c h m a k e s i t
e a s i e r f o r a h u m a n t o i n t e r p r e t .
8. What do you know about PEP 8? Why is it
important? 
P E P 8 i s P y t h o n ’ s s t y l e g u i d e w h i c h h a s
s e t o f r u l e s f o r h o w t o f o r m a t y o u r
P y t h o n c o d e . I t i s i m p o r t a n t b e c a u s e i t
s h o w s h o w t h e P y t h o n c o d e s h o u l d b e
f o r m a t t e d .
9. Can you differentiate between pickling and Un-
pickling in Python? 
P i c k l i n g i n P y t h o n i s t h e p r o c e s s o f
c o n v e r t i n g P y t h o n o b j e c t t o b y t e s t r e a m
w h e r e a s u n p i c k i n g i s t h e r e v e r s e
o p e r a t i o n o f t h e p i c k l i n g .
10. How will you find the bugs and errors in a
Python code? 
T o f i n d t h e b u g s a n d e r r o r s i n P y t h o n
c o d e w e ’ l l u s e P y t h o n D e b u g g e r t o o l o r
P D B .
11. Can you state the names of the tool which are
used to find bugs in Python?
P y C h e c k e r i s u s e d t o f i n d b u g s i n P y t h o n .
P y l i n t i s a n o t h e r t o o l w h i c h c a n b e u s e d
t o d e t e c t e r r o r s .
12. How can you alter functions in Python
syntax? 
B y u s i n g P y t h o n d e c o r a t o r s w e c a n a l t e r
t h e f u n c t i o n s e a s i l y .
13. What is the use of dictionaries in Python? 
D i c t i o n a r i e s i n P y t h o n a r e u s e d f o r
m a p p i n g o f u n i q u e k e y s t o v a l u e s .
14. What are the major two versions of Python
Programming language?
P y t h o n 2 . 0 a n d P y t h o n 3 . 0 a r e t h e t w o
v e r s i o n s u s e d P y t h o n p r o g r a m m i n g
l a n g u a g e .
15. What is “The Zen of Python”? 
I t i s t h e p r i n c i p l e w h i c h i n f l u e n c e s t h e
d e s i g n o f t h e p y t h o n p r o g r a m m i n g .
16. Which command do you use to exit the help
window in Python programming? 
T o e x i t t h e h e l p w i n d o w i n P y t h o n
p r o g r a m m i n g ‘ p r e s s q ’ .
17. How would you list all the built-in functions
and variables in Python? 
B y u s i n g h e l p ( ) f u n c t i o n o r d i r ( ) f u n c t i o n
w e c a n l i s t a l l t h e b u i l t - i n f u n c t i o n s t h a t
a r e a v a i l a b l e i n t h e P y t h o n .
18. Explain module in Python? 
T h e M o d u l e i s u s e d t o s t r u c t u r e a P y t h o n
p r o g r a m . M o d u l e s b a s i c a l l y c o n t a i n a s e t
o f f u n c t i o n s w h i c h y o u w a n t t o u s e i n a
P y t h o n p r o g r a m .
19. How will you find methods or attributes of an
object? 
W e c a n f i n d m e t h o d s o r a t t r i b u t e s o f a n
o b j e c t b y u s i n g b u i l t - i n f u n c t i o n s . H e l p ( )
o r d i r ( ) c a n b e u s e d t o f i n d t h e a t t r i b u t e s
o f a n o b j e c t .
20. What do you know about mutable and
immutable types in Python? They are the built-in 
T y p e s o f P y t h o n . M u t a b l e b u i l t - i n t y p e s
a r e l i s t , s e t s , a n d d i c t i o n a r i e s . I m m u t a b l e
b u i l t - i n t y p e s a r e s t r i n g s , t u p l e s , a n d
n u m b e r s .
21. Why isn’t memory freed whenever the Python
exits? 
M e m o r y i s n ’ t f r e e d b e c a u s e P y t h o n d o e s
n o t t r y t o d e s t r o y e v e r y s i n g l e o f i t s
o b j e c t . A l s o , c e r t a i n b i t s o f m e m o r y a r e
d i s t r i b u t e d b y t h e C l i b r a r y w h i c h i s
i m p o s s i b l e t o g e t f r e e .
22. Can you explain the term monkey patching in
Python? 
M o n k e y P a t c h i n g i s a m e t h o d b y w h i c h w e
c a n e x t e n d o u r p r o g r a m m i n g w h i l e
r u n t i m e . W e c a n m o d i f y t h e c o d e o r
e x t e n d s i t w h i l e r u n t i m e .
23. What does “*args” and “**kwargs” means and
why do have to use it?
* a r g s a n d * * k w a r g s a r e t h e s p e c i a l s y n t a x
u s e d f o r t h e f u n c t i o n t o p a s s a v a r i a b l e
n u m b e r o f a r g u m e n t s t o a f u n c t i o n i n a
P y t h o n .
24. How will you modify the strings in Python?
Can you name all of them? 
W e c a n u s e d i f f e r e n t f u n c t i o n s w h i c h c a n
b e u s e d t o m o d i f y t h e s t r i n g s . S p l i t ( ) ,
s u b ( ) , a n d s u b n ( ) a r e t h e f u n c t i o n s u s e d t o
m o d i f y t h e s t r i n g s i n P y t h o n .
25. Can u state the difference between range and
xrange in Python? State their uses. 
B o t h a r e u s e d t o g e n e r a t e a l i s t o f n u m b e r
f o r t h e u s e r t o u s e . T h u s o n l y d i f f e r e n c e i s
t h a t x r a n g e o n l y r e t u r n s t h e x r a n g e o b j e c t
w h e r e a s r a n g e r e t u r n s t h e P y t h o n l i s t o f
o b j e c t .
26. Explain the term unittest. What is the use of
unittest in Python? 
U n i t t e s t i n P y t h o n p r o v i d e s a u n i t t e s t i n g
f r a m e w o r k . I t h e l p s i n a u t o m a t i o n t e s t i n g ,
s h u t d o w n c o d e f o r t e s t s , a g g r e g a t i o n o f
t e s t s a n d i n d e p e n d e n c e t e s t s .
27. Can you convert a string to a number and
how? 
Y e s , w e c a n c o n v e r t a s t r i n g t o a n u m b e r
b y u s i n g b u i l t - i n f u n c t i o n s i n P y t h o n . F o r
e x a m p l e , c h = “ 4 7 8 9 ” i s a s t r i n g w h i c h c a n
b e c o n v e r t e d t o a n i n t e g e r b y u s i n g
n u m = i n t ( c h )
28. Can you copy an object in Python and how? 
Y o u c a n n o t c o p y m o s t o f t h e o b j e c t s b u t
s t i l l b y u s i n g c o p y . c o p y ( ) o r
c o p y . d e e p c o p y ( ) w e c a n c o p y a n o b j e c t i n
P y t h o n .
29. Can you copy an object in Python and how? 
Y o u c a n n o t c o p y m o s t o f t h e o b j e c t s b u t
s t i l l b y u s i n g c o p y . c o p y ( ) o r
c o p y . d e e p c o p y ( ) w e c a n c o p y a n o b j e c t i n
P y t h o n .