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

_Introduction to Python Interview Questions

This document contains a list of Python interview questions intended for personal use by the owner. The questions cover various topics such as Python interpretation, decorators, data types, and programming tasks. It emphasizes the legal implications of sharing or publishing the content.

Uploaded by

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

_Introduction to Python Interview Questions

This document contains a list of Python interview questions intended for personal use by the owner. The questions cover various topics such as Python interpretation, decorators, data types, and programming tasks. It emphasizes the legal implications of sharing or publishing the content.

Uploaded by

Arjun Reddy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

rohankuldhar11@gmail.

com
B7MZT6YEQO

Introduction to Python
Interview Questions
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
1. How is Python interpreted?
2. What are Python Decorators?
3. What is the difference between list and tuple?
4. How are arguments passed by value or by reference?
5. What is the difference between Xrange and range?
6. Mention what are the rules for local and global variables in python?
7. What are generators in Python?
8. What is docstring in Python?
9. What is PEP 8?
1 0 .W h a t i s p i c k l i n g a n d u n p i c k l i n g ?
1 1 .E x p l a i n h o w y o u c a n g e n e r a t e r a n d o m n u m b e r s i n P y t h o n ?
1 2 .W h a t i s t h e p u r p o s e o f t h e p a s s s t a t e m e n t i n P y t h o n ?
1 3 .W h a t i s t h e o u t p u t o f [ 1 , 2 , 3 ] + [ 5 , 6 , 7 ] ?
1 4 .W h a t i s t h e p u r p o s e o f t h e P Y T H O N P A T H e n v i r o n m e n t v a r i a b l e ?
1 5 .W h a t i s t h e o u t p u t o f p r i n t l i s t [ 2 : ] i f l i s t [ ‘ a b c d ’ , 7 8 6 , 2 . 2 3 , ’ J o h n ’ , 7 0 . 2 ] ?
1 6 .W h a t i s p u r p o s e o f / / , % a n d * * o p e r a t o r s ?
1 7 .H o w d o y o u g e t a l i s t o f a l l t h e k e y s i n a d i c t i o n a r y ?
1 8 .H o w w i l l y o u c h e c k i f a l l c h a r a c t e r s i n a s t r i n g a r e a l p h a n u m e r i c ?
1 9 .G i v e n t h e f i r s t a n d l a s t n a m e s o f a l l e m p l o y e e s i n y o u r f i r m . W h a t d a t a
type will you use to store it?
2 0 .I f y o u a r e e v e r s t u c k i n a n i n f i n i t e l o o p , h o w w i l l y o u b r e a k o u t o f i t ?
2 1 .Y o u a r e g i v e n a s e q u e n c e o f w o r d s s e p a r a t e d b y ' - ' . W r i t e a p r o g r a m t o
[email protected]
B7MZT6YEQO
perform the following tasks: Sort the words in the string in ascending
order and return the difference between the first word(sum of ASCII
values of all characters in the first word) and the last word(sum of ASCII
values of all characters in the last word).Sample input - English-is-a-
language
2 2 .Y o u a r e g i v e n a n i n p u t i n t e g e r X . W r i t e a p r o g r a m t o p e r f o r m t h e
following tasks:
a. a)Create a 2-Dimensional tuple.
b. b)The tuple must be [i, n^2], where "i" will range from 1 to X and "n"
is the square of "i". For every "i", a tuple must be generated with its
square. Example: [1,1],[2,4]
c. c)Return the sum of all elements of the 2-D list as an integer.Sample
Input - 4 , Output - [1,1],[2,4],[3,9],[4,16] sum = 40
2 3 .Y o u a r e g i v e n a n i n p u t s t r i n g . W r i t e a p r o g r a m t o p e r f o r m t o r e p l a c e a l l
'a' with 'b' and all the 'b' with 'a'. Sample input: abaaaccbc aa bbb ccc
2 4 .Y o u a r e g i v e n a s t r i n g i n p u t S . W r i t e a p r o g r a m t o p e r f o r m t o e x t r a c t a l l
the even indexed characters (Zero-th index also included).
2 5 .Y o u a r e g i v e n a l i s t o f i n t e g e r s . W r i t e a p r o g r a m t o r e m o v e n u m b e r s t h a t
are divisible by 5 or 7 from the list using list comprehension.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.

You might also like