Interview Questions for python
Interview Questions for Python
Question : 1 What is the difference between a keyword and an identifier?
Question : 2 What are literals in Python? How many types of Literals allowed in Python?
Question : 3 How many types of sequences are supported in Python?
Question : 4 What factors guide the choice of identifiers in program?
Question : 5 What is the difference between an expression and a statement in Python?
Question : 6 What are tokens in Python? How many types of tokens allowed in Python?
Question : 7 What is the role of indentation in Python?
Question : 8 What are data types? What are Python built in core data types?
Question : 9 Which data types of Python handle Numbers?
Question : 10 What do you understand by term immutable?
Question : 11 What are mutable and immutable types in Python? List both of them.
Question : 12 What are augmented assignment operators? How are they useful?
Question : 13 Why are logical errors harder to locate?
Question : 14 What is an Exception?
Question : 15 Why is Exception Handling is required?
Question : 16 What is the need for debugger tool?
Question : 17 What are main error types? Which types are most dangerous and why?
Question : 18 What is a difference between an error and exception?
Question : 19 What is debugging and code tracing?
Question : 20 What are nested Lists?
Question : 21 Discuss the utility and significance of Lists.
Question : 22 What is the purpose of the del operator and pop method? Try deleting a slice.
Question : 23 What are list slices?
Question : 24 What do you understand by true copy of a list? How is it different from shallow copy?
Question : 25 What do you understand by immutability?
Question : 26 How are Tuples different from Lists when both are sequences?
Question : 27 Discuss the utility and significance of Tuples.
Question : 28 How can you say that a tuple is an ordered list of objects?
Question : 29 How are dictionaries different from Lists?
Question : 30 When are dictionaries more useful than lists?
Question : 31 Discuss the utility and significance of Dictionaries.
Question : 32 Why is a dictionary termed as an unordered collection of objects?
Question : 33 How is clear() function different from del Statement?
Question : 34 What is the significance of modules?
Question : 35 What is dot notation of referring to objects inside a module?
Question : 36 What is a function? How is it useful?
Question : 37 What is Pandas library of Python? What is its significance?
Question : 38 How is Series data structure different from a DataFrame data structure?
Question : 39 What is a DataFrame object? How it is created in Python?
Question : 40 What are advantages of CSV file formats?
Question : 41 What is sqlite3 library of Python?
Question : 42 Can nongraphic characters be used in Python ? How ? Give examples to support your answer.
Can nongraphic characters be used in Python ? How ? Give examples to support your answer.
Question : 43 What is a cross-platform software?
What is a cross-platform software?
Question : 44 What are the advantages of Python programming language?
What are the advantages of Python programming language?
Question : 45 What are some limitations of Python programming language?
What are some limitations of Python programming language?
Question : 46 In how many different ways, can you work in Python?
In how many different ways, can you work in Python?
Question : 47 What are advantages/disadvantages of working in Interactive mode in Python?
What are advantages/disadvantages of working in Interactive mode in Python?
Question : 48 What are the advantages/disadvantages of working in script mode in Python?
What are the advantages/disadvantages of working in script mode in Python?
Question : 49 How are keywords different from identifiers ?
How are keywords different from identifiers ?
Question : 50 How are floating constants represented in Python ? Give examples to support your answer.
How are floating constants represented in Python ? Give examples to support your answer.
Question : 51 How are string-literals represented and implemented in Python ?
How are string-literals represented and implemented in Python ?
Question : 52 What are operators ? What is their function ? Give examples of some unary and binary operators.
What are operators ? What is their function ? Give examples of some unary and binary operators.
Question : 53 What is an expression and a statement ?
What is an expression and a statement ?
Question : 54 What all components can a Python program contain ?
What all components can a Python program contain ?
Question : 55 What do you understand by block/code block/suite in Python ?
What do you understand by block/code block/suite in Python ?
Question : 56 What are variables ? How are they important for a program ?
What are variables ? How are they important for a program ?
Question : 57 What do you understand by undefined variable in Python ?
What do you understand by undefined variable in Python ?
Question : 58 What is Dynamic Typing feature of Python ?
What is Dynamic Typing feature of Python ?
Question : 59 What is the common structure of Python compound statements?
What is the common structure of Python compound statements?
Question : 60 What is the importance of the three programming constructs?
What is the importance of the three programming constructs?
Question : 61 What is empty statement in Python? What is its need?
What is empty statement in Python? What is its need?
Question : 62 Which Python statement can be termed as empty statement?
Which Python statement can be termed as empty statement?
Question : 63 What is an algorithm?
What is an algorithm?
Question : 64 What is a flowchart? How is it useful?
What is a flowchart? How is it useful?
Question : 65 What is entry-controlled loop?
What is entry-controlled loop?
Question : 66 What are the four elements of a while loop in Python?
What are the four elements of a while loop in Python?
Question : 67 What is the difference between else clause of if-else and else clause of Python loops?
What is the difference between else clause of if-else and else clause of Python loops?
Question : 68 In which cases, the else clause of a loop does not get executed?
In which cases, the else clause of a loop does not get executed?
Question : 69 What are jump statements? Name them.
What are jump statements? Name them.
Question : 70 How and when are named conditions useful?
How and when are named conditions useful?
Question : 71 What are endless loops ? Why do such loops occur?
What are endless loops ? Why do such loops occur?
Question : 72 How is break statement different from continue?
How is break statement different from continue?
Question : 73 Define Operator and Operand.
Define Operator and Operand.
Question : 74 What is the use of type()?
What is the use of type()?
Question : 75 The modulus operator is used to produce the quotient in division. Is it True or False ?
The modulus operator is used to produce the quotient in division. Is it True or False ?
Question : 76 Describe the use parentheses in expressions.
Describe the use parentheses in expressions.
Question : 77 Describe how Python evaluates an expression containing parentheses.
Describe how Python evaluates an expression containing parentheses.
Question : 78 Explain the use of the assignment operator.
Explain the use of the assignment operator.
Question : 79 What is the difference between Expressions and Operators?
What is the difference between Expressions and Operators?
Question : 80 Example not (boolean Not) with an example.
Question : 81 Example not (boolean Not) with an example.
Question : 82 Example and (boolean AND) with example.
Example and (boolean AND) with example.
Question : 83 Example or (boolean OR) with example.
Example or (boolean OR) with example.
Question : 84 Explain Associativity of operators wit6h example.
Explain Associativity of operators wit6h example.
Question : 85 What is the difference between * and **? Explain with an example.
What is the difference between * and **? Explain with an example.
Question : 86 What is the difference between << (left shift) and >> (right shift) operators ?
What is the difference between << (left shift) and >> (right shift) operators ?
Question : 87 What is the difference between & (bit-wise AND), and I (bit-wise OR) operators?
What is the difference between & (bit-wise AND), and I (bit-wise OR) operators?
Question : 88 Explain not ( boolean NOT ) with an example
Explain not ( boolean NOT ) with an example
Question : 89 What is an expression ?
Question : 90 What is a statement ?
What is a statement ?
Question : 91 What do you mean by floor division ?
What do you mean by floor division ?
Question : 92 What is the difference between "=" and "==" ?
What is the difference between "=" and "==" ?
Question : 93 What don you mean by precedence and associativity of operators ?
What don you mean by precedence and associativity of operators ?
Question : 94 What are Identity and Membership operators ?
What are Identity and Membership operators ?
Question : 95 Explain different bitwise operators.
Explain different bitwise operators.
Question : 96 What will be the result of 5.0/3 and 5.0 / / 3 ?
What will be the result of 5.0/3 and 5.0 / / 3 ?
Question : 97 What is the difference between + and * operators of List ?
Question : 98 What is boolean data type ? Explain with an example.
What is boolean data type ? Explain with an example.
Question : 99 What is the difference between pow() and**?
What is the difference between pow() and**?
Question : 100 What is the deference between expression and statement ?
What is the deference between expression and statement ?
Question : 101 What is the difference between num = 20 and num == 20?
What is the difference between num = 20 and num == 20?
Question : 102 What is conditional branching ?
What is conditional branching ?
Question : 103 What is looping ?
What is looping ?
Question : 104 Explain if statement.
Explain if statement.
Question : 105 Explain range() function ?
Explain range() function ?
Question : 106 Mention the similarity and difference between break and continue statements.
Mention the similarity and difference between break and continue statements.
Question : 107 What is the function of break statement in a while or for loop ?
What is the function of break statement in a while or for loop ?
Question : 108 What is the use of Control structures ?
What is the use of Control structures ?
Question : 109 How many types of control structures are there ? Explain.
How many types of control structures are there ? Explain.
Question : 110 Explain Selection logic.
Explain Selection logic.
Question : 111 What do you mean by flow-of-control ?
What do you mean by flow-of-control ?
Question : 112 What do you mean by selection statements ?
What do you mean by selection statements ?
Question : 113 What is the minimum number of iteration that while loop could make ?
What is the minimum number of iteration that while loop could make ?
Question : 114 What is the difference between entry controlled loop and exit-controlled loop?
What is the difference between entry controlled loop and exit-controlled loop?
Question : 115 What are jump statements ?
What are jump statements ?
Question : 116 What is Iteration ?
What is Iteration ?
Question : 117 What are strings ?
What are strings ?
Question : 118 Differentiate between physical line and logical line.
Differentiate between physical line and logical line.
Question : 119 What is the difference between (+) and (*) operators?
What is the difference between (+) and (*) operators?
Question : 120 What is the difference between Istrip() and rstrip() ?
What is the difference between Istrip() and rstrip() ?
Question : 121 What do you mean by' strings are immutable ?
What do you mean by' strings are immutable ?
Question : 122 What is the function of slicing operation ?
What is the function of slicing operation ?
Question : 123 What is the use of Docstrings ?
What is the use of Docstrings ?
Question : 124 How are empty strings represented in Python ?
How are empty strings represented in Python ?
Question : 125 "The quotes are not a part of strings". Comment.
"The quotes are not a part of strings". Comment.
Question : 126 Differentiate between ord() and chr() functions.
Differentiate between ord() and chr() functions.
Question : 127 Write short note on subscript.
Write short note on subscript.
Question : 128 What do you mean by positive and negative indices ?
What do you mean by positive and negative indices ?
Question : 129 'String indices must be an integer'. Comment.
'String indices must be an integer'. Comment.
Question : 130 What do you mean by traversing a string ?
What do you mean by traversing a string ?
Question : 131 Write short note on membership operators.
Write short note on membership operators.
Question : 132 What is the significance of list ?
What is the significance of list ?
Question : 133 Lists are mutable. Comments ?
Lists are mutable. Comments ?
Question : 134 Why are Python Lists called dynamic arrays ?
Why are Python Lists called dynamic arrays ?
Question : 135 How do list indices work in Python ?
How do list indices work in Python ?
Question : 136 Explain count() method with example.
Question : 137 What is index() method used for ?
What is index() method used for ?
Question : 138 What is aliasing ? Explain with an example.
What is aliasing ? Explain with an example.
Question : 139 What do you mean by sequence ?
What do you mean by sequence ?
Question : 140 What is indexing ?
What is indexing ?
Question : 141 What is the default value for the first index if you omit the first index value in a slice ?
What is the default value for the first index if you omit the first index value in a slice ?
Question : 142 What is the default value for the second index if you omit the second index value in a slice?
What is the default value for the second index if you omit the second index value in a slice?
Question : 143 What is the purpose of negative slice indices ?
What is the purpose of negative slice indices ?
Question : 144 Explain the functions of del statement, pop() and remove().
Explain the functions of del statement, pop() and remove().
Question : 145 If two list are equivalent, is it necessary that they are identical also. Explain with an example.
If two list are equivalent, is it necessary that they are identical also. Explain with an example.
Question : 146 Name three types of sequence objects.
Question : 147 Which item in the sequence is selected for an index value of - 1?
Which item in the sequence is selected for an index value of - 1?
Question : 148 Just like C, C++, and Java, Python supports character type; True or False ?
Just like C, C++, and Java, Python supports character type; True or False ?
Question : 149 How are lists formed ?
How are lists formed ?
Question : 150 What are the characteristics of list ?
What are the characteristics of list ?
Question : 151 What is tuple ?
What is tuple ?
Question : 152 A tuple in Python is immutable. Comment.
A tuple in Python is immutable. Comment.
Question : 153 What is the difference between objects and methods ?
What is the difference between objects and methods ?
Question : 154 Is an item assignment an a tuple possible ?
Is an item assignment an a tuple possible ?
Question : 155 What is len() function used for in list and tuple?
What is len() function used for in list and tuple?
Question : 156 What is the use of in operator ?
What is the use of in operator ?
Question : 157 Write short note on tuple assignment.
Write short note on tuple assignment.
Question : 158 How will you create tuple with zero element and 1 element ?
How will you create tuple with zero element and 1 element ?
Question : 159 Compare and contrast tuples and list.
Compare and contrast tuples and list.
Question : 160 Can we update tuples?
Can we update tuples?
Question : 161 What is the difference between list and tuple ?
What is the difference between list and tuple ?
Question : 162 Identity the following as mutable or immutable:
lists, numbers, strings, tuples and dictionaries.
Identity the following as mutable or immutable:
lists, numbers, strings, tuples and dictionaries.
Question : 163 How will you create an empty tuple ?
How will you create an empty tuple ?
Question : 164 What is dictionary?
What is dictionary?
Question : 165 Compare and contrast dictionaries (dicts) with other Python data types.
Compare and contrast dictionaries (dicts) with other Python data types.
Question : 166 What are the advantages of hash ?
What are the advantages of hash ?
Question : 167 Does Python store dictionary elements in any particular order?
Does Python store dictionary elements in any particular order?
Question : 168 What is a mapping ?
What is a mapping ?
Question : 169 What is another name for mapping ?
What is another name for mapping ?
Question : 170 What are the characteristics of a Python dictionary?
What are the characteristics of a Python dictionary?
Question : 171 A dictionary is an mutable object. Comment.
A dictionary is an mutable object. Comment.
Question : 172 A dictionary is an unordered collection of objects. Comment.
A dictionary is an unordered collection of objects. Comment.
Question : 173 Can sequence operations, such as slicing and concatenation, be applied to dictionaries?
Can sequence operations, such as slicing and concatenation, be applied to dictionaries?
Question : 174 Write the syntax of a dictionary.
Write the syntax of a dictionary.
Question : 175 Can you remove key:value pairs from a dictionary. If so, how ?
Can you remove key:value pairs from a dictionary. If so, how ?
Question : 176 What do you mean by traversing a dictionary ?
What do you mean by traversing a dictionary ?
Question : 177 Can you merge two dictionaries ? If so, how?
Can you merge two dictionaries ? If so, how?
Question : 178 Discuss the properties of Dictionary Keys.
Discuss the properties of Dictionary Keys.
Question : 179 What do the keys(), values() and items() functions do ?
What do the keys(), values() and items() functions do ?
Question : 180 Write different capabilities of dictionary.
Write different capabilities of dictionary.
Question : 181 Write difference between lists and dictionaries.
Write difference between lists and dictionaries.
Question : 182 What is the purpose of a header file in a Python program?
What is the purpose of a header file in a Python program?
Question : 183 What is function ?
What is function ?
Question : 184 What are the advantages of using functions.
What are the advantages of using functions.
Question : 185 What is function definition ?
What is function definition ?
Question : 186 Write a short note on built-in function.
Write a short note on built-in function.
Question : 187 How is built-in function accessed ?
How is built-in function accessed ?
Question : 188 How will you import all functions in the math module ?
How will you import all functions in the math module ?
Question : 189 What is difference between cell() and floor() functions?
What is difference between cell() and floor() functions?
Question : 190 What is Python module ?
What is Python module ?
Question : 191 How will you import specific names only within a module?
How will you import specific names only within a module?
Question : 192 Write short note on user defined function.
Write short note on user defined function.
Question : 193 What is difference between pow() and **?
What is difference between pow() and **?
Question : 194 What do you mean by Regular expressions ?
What do you mean by Regular expressions ?
Question : 195 What is a metacharacter?
What is a metacharacter?
Question : 196 How match() function is different from search() function ?
How match() function is different from search() function ?
Question : 197 What do you mean by greedy match and non greedy match ?
What do you mean by greedy match and non greedy match ?
Question : 198 Differentiate between max() and min() functions ?
Differentiate between max() and min() functions ?
Question : 199 Write a short note on random module.
Write a short note on random module.
Question : 200 Write a short note on randint().
Write a short note on randint().
Question : 201 Observe the following Python function and write the name(s) of the module(s) to which they belong:
a. uniform() b. findall()
Observe the following Python function and write the name(s) of the module(s) to which they belong:
a. uniform() b. findall()
Question : 202 What is file Pointer ?
What is file Pointer ?
Question : 203 Discuss various modes to open a file.
Discuss various modes to open a file.
Question : 204 Write short note on binary mode of opening a file.
Write short note on binary mode of opening a file.
Question : 205 Differentiate between read() and readline().
Differentiate between read() and readline().
Question : 206 Write function of a+ mode.
Write function of a+ mode.
Question : 207 What are different ways to read from a file ?
What are different ways to read from a file ?
Question : 208 What are command line arguments?
What are command line arguments?
Question : 209 Why do we use command line arguments ?
Why do we use command line arguments ?
Question : 210 What is the use of getopt method ?
What is the use of getopt method ?
Question : 211 What are the different file processing modes supported by Python ?
What are the different file processing modes supported by Python ?
Question : 212 What is pickling and unpickling in Python ?
What is pickling and unpickling in Python ?
Question : 213 What is the use of offset ?
What is the use of offset ?
Question : 214 Write a statement in Python to open a text file DATA.TXT so that new contents can be written in it.
Write a statement in Python to open a text file DATA.TXT so that new contents can be written in it.
Question : 215 Differentiate between readlines() and readline() functions.
Differentiate between readlines() and readline() functions.
Question : 216 Name two functions which allow us to access a file in a non-sequential or random mode.
Name two functions which allow us to access a file in a non-sequential or random mode.
Question : 217 Name the file which is stored in human readable form and can also be created using any text editor.
Name the file which is stored in human readable form and can also be created using any text editor.
Question : 218 What is the use of seek() and tell() methods?
What is the use of seek() and tell() methods?
Question : 219 What is the use of close() method ?
What is the use of close() method ?
Question : 220 What do you understand by module and package ?
What do you understand by module and package ?
Question : 221 What do you mean by LEGB ?
What do you mean by LEGB ?
Question : 222 What is namespace in Python ?
What is namespace in Python ?
Question : 223 Name any two commonly used build-in modules.
Name any two commonly used build-in modules.
Question : 224 What do you mean by Global variable ?
What do you mean by Global variable ?
Question : 225 What do you mean by Built-in ?
What do you mean by Built-in ?
Question : 226 What do you understand by following import statement :
from x import a, b, c
What do you understand by following import statement :
from x import a, b, c
Question : 227 What do you mean by reloading module ?
What do you mean by reloading module ?
Question : 228 How will you import all the attributes from a module ?
How will you import all the attributes from a module ?
Question : 229 Write short note on from-import statement.
Write short note on from-import statement.
Question : 230 What is numpy ?
What is numpy ?
Question : 231 Name the module you will import to use numpy ?
Name the module you will import to use numpy ?
Question : 232 What is slicing ?
What is slicing ?
Question : 233 What do you mean by Axes in numpy ?
What do you mean by Axes in numpy ?
Question : 234 What do you mean by Rank in numpy ?
What do you mean by Rank in numpy ?
Question : 235 Write short note on slicing.
Write short note on slicing.
Question : 236 What is the purpose of negative index values in NumPy ?
What is the purpose of negative index values in NumPy ?
Question : 237 Define Array and NumPy array.
Define Array and NumPy array.
Question : 238 Explain membership operator in with example.
Explain membership operator in with example.
Question : 239 What is Numpy?
What is Numpy?