Dear readers, these Python Programming Language Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of Python Programming Language. As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer −
Python Basics Interview Questions
What is Python?Name some of the features of Python.Is Python a case-sensitive language?Is the Python platform independent?What are the applications of Python?What is the basic difference between Python version 2 and Pythonversion 3?Is there any double data type in Python?Are strings in Python immutable? (Yes/No)Can True = False be possible in Python?
Python Environment Variables Interview Questions
What is the purpose of PYTHONPATH environment variable?What is the purpose of PYTHONSTARTUP environment variable?What is the purpose of PYTHONCASEOK environment variable?What is the purpose of PYTHONHOME environment variable?
Python Data Types and Operations Interview Questions
What are the supported data types in Python?What is the output of print str if str = ‘Hello World!’?What is the output of print str[0] if str = ‘Hello World!’?What is the output of print str[2:5] if str = ‘Hello World!’?What is the output of print str[2:] if str = ‘Hello World!’?What is the output of print str * 2 if str = ‘Hello World!’?What is the output of print str + “TEST” if str = ‘Hello World!’?What is the output of print list if list = [‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?What is the output of print list[0] if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?What is the output of print list[1:3] if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?What is the output of print list[2:] if list = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ]?What is the output of print tinylist * 2 if tinylist = [123, ‘john’]?What is the output of print list1 + list2 if list1 = [ ‘abcd’, 786 , 2.23, ‘john’, 70.2 ] and list2 = [123, ‘john’]?
Python Tuples Interview Questions
What are tuples in Python?What is the difference between tuples and lists in Python?What is the output of print tuple if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?What is the output of print tuple[0] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?What is the output of print tuple[1:3] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?What is the output of print tuple[2:] if tuple = ( ‘abcd’, 786 , 2.23, ‘john’, 70.2 )?What is the output of print tinytuple * 2 if tinytuple = (123, ‘john’)?What is the output of print tuple + tinytuple if tuple = (‘abcd’, 786 , 2.23, ‘john’, 70.2 ) and tinytuple = (123, ‘john’)?
Python Dictionaries Interview Questions
What are Python’s dictionaries?How will you create a dictionary in Python?How will you get all the keys from the dictionary?How will you get all the values from the dictionary?
Python Strings Interview Questions
How will you convert a string to an int in Python?How will you convert a string to a float in Python?How will you convert an object to a string in Python?How will you convert an object to a regular expression in Python?How will you convert a string to an object in Python?How will you convert a string to a tuple in Python?How will you convert a string to a list in Python?How will you convert a string to a set in Python?How will you create a dictionary using tuples in Python?How will you capitalize the first letter of a string?How will you check if all characters in a string are alphanumeric?How will you check if all characters in a string are digits?How will you check if all characters in a string are lowercase?How will you check if all characters in a string are numerics?How will you check if all characters in a string are whitespaces?How will you check if a string is properly title-cased?How will you check if all characters in a string are uppercase?How will you merge elements in a sequence?How will you get the length of the string?How will you get a space-padded string with the original string left-justified to a total of width columns?How will you convert a string to all lowercase?How will you remove all leading whitespace in a string?How will you get the max alphabetical character from the string?How will you get the min alphabetical character from the string?How will you replace all occurrences of an old substring in a string with a new string?How will you remove all leading and trailing whitespace in a string?How will you change the case of all letters in a string?How will you get a title-cased version of the string?How will you convert a string to all uppercase?How will you check if all characters in a string are decimal?
Python Lists Interview Questions
What is the difference between del() and remove() methods of a list?What is the output of len([1, 2, 3])?What is the output of [1, 2, 3] + [4, 5, 6]?What is the output of [‘Hi!’] * 4?What is the output of 3 in [1, 2, 3]?What is the output of for x in [1, 2, 3]: print x?What is the output of L[2] if L = [1,2,3]?What is the output of L[-2] if L = [1,2,3]?What is the output of L[1:] if L = [1,2,3]?How will you compare two lists?How will you get the length of a list?How will you get the max valued item of a list?How will you get the min valued item of a list?How will you get the index of an object in a list?How will you insert an object at a given index in a list?How will you remove the last object from a list?How will you remove an object from a list?How will you reverse a list?How will you sort a list?
Python Operators Interview Questions
What is the purpose of ** operator?What is Python?What is the purpose of // operator?What is the purpose of is operator?What is the purpose of not in operator?
Python Control Statements Interview Questions
What is the purpose of the break statement in Python?What is the purpose of the continue statement in Python?What is the purpose of the pass statement in Python?
Python Random Module Interview Questions
How can you pick a random item from a list or tuple?How can you pick a random item from a range?How can you get a random number in Python?How will you set the starting value in generating random numbers?How will you randomize the items of a list in place?
Python Functions and Memory Interview Questions
What is a lambda function in Python?What do we call a function which is an incomplete version of a function?When a function is defined, the system stores parameters and local variables in an area of memory. What is this memory known as?
Python Modules and Libraries Interview Questions
Which module of Python is used to apply the methods related to OS?Name the Python library used for Machine Learning.Name the tools Python uses to find bugs (if any).
Leave a Reply