Python Interview Questions
1 .
How will you check in a string that all characters are in lowercase?
islower() : Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.
2 .
How will you check in a string that all characters are in uppercase?
isupper() : Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.
3 .
How will you check in a string that all characters are numerics?
isnumeric() : Returns true if a unicode string contains only numeric characters and false otherwise.
4 .
How will you check in a string that all characters are whitespaces?
isspace() : Returns true if string contains only whitespace characters and false otherwise.
5 .
What is the different between range () and xrange () functions in Python ?
range () returns a list whereas xrange () returns an object that acts like an iterator for generating numbers on demand.
6 .
What is a pass in Python?
Pass in Python signifies a no operation statement indicating that nothing is to be done.
7 .
Which tool in Python will you use to find bugs if any?
Pylint and Pychecker. Pylint verifies that a module satisfies all the coding standards or not. Pychecker is a static analysis tool that helps find out bugs in the course code.
8 .
How are arguments passed by value or by reference?
Everything in Python is an object and all variables hold references to the objects. The references values are according to the functions; as a result you cannot change the value of the references. However, you can change the objects if it is mutable.
9 .
What is lambda in Python?
An anonymous function is known as a lambda function. This function can have any number of parameters but, can have just one statement.
 
Example :
a = lambda x,y : x+y
print(a(5, 6))
Output : 11
10 .
What is module and package in Python?
In Python, module is the way to structure program. Each Python program file is a module, which imports other modules like objects and attributes.
The folder of Python program is a package of modules.  A package can have modules or subfolders.