|
S. No.
|
Question
|
|---|---|
|
1
|
Which of the given function is defined as None Function?
|
|
2
|
What is the output of the given code snippet? def foo(fname, val): print(fname(val))foo(max, [1, 2, 3])foo(min, [1, 2, 3])
|
|
3
|
List1 is [2, 33, 222, 14, 25], What is list1[-1]?
|
|
4
|
What will be the return type of type(s)? Say s = "abcd"
|
|
5
|
Text encoding in Python 3 is done in
|
|
6
|
What is the output of the given code snippet? >>>max("what are you")
|
|
7
|
How many arguments the help function, can take
|
|
8
|
What is the output of the given code? x = 'abcd'for i in x: print(i.upper())
|
|
9
|
What will be the output of the given code snippet? numbers = [1, 2, 3, 4]numbers.append([5,6,7,8])print(len(numbers))
|
|
10
|
A function is defined in _______________.
|
|
11
|
What is the output of the given code snippet? x = [12, 34] print(len(list(map(int, x))))
|
|
12
|
Which of the following method are used to read from file
|
|
13
|
What will be the output of the given code snippet? kvps = { '1' : 1, '2' : 2 }theCopy = kvps.copy()kvps['1'] = 5sum = kvps['1'] + theCopy['1']print(sum)
|
|
14
|
The pass statement is used for
|
|
15
|
On UNIX systems, the command to make Python source file, executable, is
|
|
16
|
The return value of trunc() is _______________.
|
|
17
|
When a module is imported for first time then,
|
|
18
|
What is the value in 'x' from following expression x = 19 % 4 + 15 / 2 * 3
|
|
19
|
What is the output of the given code snippet? i = 1while True: if i%3 == 0: break print(i) i + = 1
|
|
20
|
What will be the output of the following? “helloâ€+1+2+3?
|
|
21
|
What is the output of the given code snippet? x = "abcdef"i = "a"while i in x: print(i, end = " ")
|
|
22
|
What is the extension of an Python program
|
|
23
|
Which of the following is used to close a file object (fp)?
|
|
24
|
Suppose list1 is [1, 5, 9], what is sum(list1) ?
|
|
25
|
Syntactically lambda forms are restricted to how many expressions
|
|
26
|
What is the value in 'x' from following expression x = 17 / 2 * 3 + 2
|
|
27
|
What does the readlines() method returns?
|
|
28
|
Which of the given arithmetic operators cannot be used with Strings?+, *, -, **
|
|
29
|
A module imported (using an variant) by import statement, does not imports
|
|
30
|
Which type of exception is raised when an operation or function is applied to an object of inappropriate type
|
|
31
|
The variadic arguments beyond the formal parameter list are contained in
|
|
32
|
What is the output of the given code snippet? i = 1while True:if i%2 == 0:breakprint(i)i += 2
|
|
33
|
What is the output of the given code snippet? i = 0while i < 3: print(i) i += 1else: print(0)
|
|
34
|
Which of the following function takes a string as argument and displays it to the user
|
|
35
|
Which amongst the following is not a core datatype?
|
|
36
|
What will be the output of the given code snippet? names1 = ['Amir', 'Barry', 'Chales', 'Dao']names2 = names1names3 = names1[:]names2[0] = 'Alice'names3[1] = 'Bob'sum = 0for ls in (names1, names2, names3): if ls[0] == 'Alice': sum += 1 if ls[1] == 'Bob': sum += 10print(sum)
|
|
37
|
If x = 545; what is the output of the given code snippet?print(“%06dâ€%x)
|
|
38
|
What will be the return type of following code snippet? print "ABCDEF".center()
|
|
39
|
What will be the return type of type(s)? print ("abababbaababaaab".count("a", 2, 14))
|
|
40
|
Which character indicates an append mode to open function
|
|
41
|
The option given at command-line interface during interpreter invocation to discard docstrings for optimization, is
|
|
42
|
What is the output of the given code snippet? x = 'abcd'for i in range(len(x)): print(i)
|
|
43
|
What is the output of the given code snippet? x = [12, 34]print(len(''.join(list(map(int, x)))))
|
|
44
|
What error shall occur when we execute the following?apple = mango
|
|
45
|
What will be the output of the given code snippet? d1 = {"john":40, "peter":45}d2 = {"john":466, "peter":45}d1 == d2
|
|
46
|
What is the output of the given code snippet? print("abc DEF".capitalize());
|
|
47
|
What is the extension of an intermediate form that Python transforms the program into
|
|
48
|
A imported module is stored as
|
|
49
|
What is the output of the following codea = ['a','b', 'c']for i in range(len(a)): print(i, a[i],end=' ')
|
|
50
|
What statement gives the following output?hello\exampleest.txt
|
|
51
|
The function used to traverse a sequence in reverse direction, is
|
|
52
|
Which statement is used to tell Python to skip the rest of the statements in the current loop block and to continue to the next iteration of the loop
|
|
53
|
No value in python is assigned by
|
|
54
|
Addition of function name in the current symbol table is done by
|
|
55
|
What is the output of given code snippet?def sum(*args): '''Function returns the sum of all values''' r = 0 for i in args: r += i return rprint(sum.__doc__)print(sum(1, 2, 3))print(sum(1, 2, 3, 4, 5))
|
|
56
|
What is the output of the given code snippet?x = "abcdef"i = "a"while i in x: x = x[:-1] print(i)
|
|
57
|
Which of the following statement terminates the loop statement and transfers execution to the statement immediately following the loop?
|
|
58
|
What will be the output of the given code snippet?boxes = {}jars = {}crates = {}boxes['cereal'] = 1boxes['candy'] = 2jars['honey'] = 4crates['boxes'] = boxescrates['jars'] = jarsprint(len(crates[boxes]))
|
|
59
|
What will be the output of the given code snippet?kvps = { '1' : 1, '2' : 2 , '3' : 3, '4' : 4, '5' : 5}newData = { '1' : 10, '3' : 30 }kvps.update(newData)print(kvps)
|
|
60
|
What is the output of the given code snippet?(str1 = 'hello'str2 = ','str3 = 'world'print str1[-1:])
|
|
61
|
ListExample is [3, 4, 5, 20, 5, 25, 1, 3],What is list1 after listExample.extend([34, 5])?
|
|
62
|
What is the output of the given code snippet?print("abcdef".center(0))
|
|
63
|
_____________ refers to mathematical function.
|
|
64
|
What is the output of the given code snippet?elements = [0, 1, 2]def incr(x): return x+1print(list(map(elements, incr)))
|
|
65
|
What is the output of the given code snippet?age = 10;if(age<10): print (age)else: print(age+3)
|
|
66
|
The version number of current python environment is checked by using which module
|
|
67
|
What will be the output of the given code snippet?kvps = { '1' : 1, '2' : 2 }theCopy = dict(kvps)kvps['1'] = 5sum = kvps['1'] + theCopy['1']print(sum)
|
|
68
|
The base class for all built-in exceptions, is
|
|
69
|
What will be the return type of type(s)?str = "Vskills"print str.find("s")
|
|
70
|
Which of the following are the advantages of functions in python?
|
|
71
|
What will be the output of the given code snippet?numberGames = {}numberGames[(1,2,4)] = -8numberGames[(4,2,1)] = -10numberGames[(1,2)] = -12sum = 0for k in numberGames: sum += numberGames[k] print(len(numberGames) + sum)
|
|
72
|
What is the value in 'x' from following expression x = 17 / 2 % 2 * 3**3
|
|
73
|
What will be the return type of following code snippet?print "ABCDEF".center()
|
|
74
|
What is the output of the given code snippet?i = 2while True: if i%3 == 0: break print(i) i += 2
|
|
75
|
The return value of trunc() is _______________
|
|
76
|
What will be the return type of type(s)?str = "Vskills"print str.rfind("s")
|
|
77
|
Given the following code, will the program terminate?balance = 14while(True): if(balance<13): break balance = balance-13
|
|
78
|
Extra parameters in the exception object can be stored by including them in
|
|
79
|
Python commands can be executed directly by interpreter with using the switch
|
|
80
|
Reloading a module when it has already been imported is done by using which function
|
|
81
|
The module name is stored by which variable
|
|
82
|
What is the output of the given code snippet?print type(type(int))
|
|
83
|
What is the output of the given code snippet?def foo(fname, val): print(fname(val))foo(max, [1, 2, 3])foo(min, [1, 2, 3])
|
|
84
|
The data structure which is immutable, is
|
|
85
|
Arrange the following in the order of precedence in Python.i) Parenthesesii) Exponentialiii) Divisioniv) Multiplicationv) Additionvi) Subtraction
|
|
86
|
What is the output of the given code snippet?print(0xA + 0xB + 0xC)
|
|
87
|
What is the output of the given code snippet?(print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12)))
|
|
88
|
What will be the output of the given code snippet?aList = [1,2]bList = [3,4]kvps = { '1' : aList, '2' : bList }theCopy = kvps.copy()kvps['1'][0] = 5sum = kvps['1'][0] + theCopy['1'][0]print(sum)
|
|
89
|
What will be the output of the given code snippet?(names1 = ['Amir', 'Bala', 'Charlie']names2 = [name.lower() for name in names1]print(names2[2][0]))
|
|
90
|
What will be the return type of type(s)? print("abc DEF".capitalize())
|
|
91
|
To insert 5 to the third position in list1, which command is used?
|
|
92
|
Python supports the creation of anonymous functions at runtime, using a construct called ___________________
|
|
93
|
The weakly internal variables have, which special character to recognize them
|
|
94
|
What is the output of the given code snippet?(class Test: def __init__(self): self.str = "Functions" self.x = 15 def fun(): return Test()t = fun() print(t.x)print(str))
|
|
95
|
How do you do a random shuffle in a list named list1?
|
|
96
|
What is the output of the given code snippet?(i = 5while True: if i%0O9 == 0: break print(i) i += 1)
|
|
97
|
The _______________ module in the python standard library parses options received from the command line.
|
|
98
|
What is the output of the given code snippet?(x = "Hello World"print "%s" % x[4:8])
|
|
99
|
What will be the output of the given code snippet?(kvps = { '1' : 1, '2' : 2 }theCopy = kvps.copy()kvps['1'] = 5sum = kvps['1'] + theCopy['1']print(sum))
|
|
100
|
What will be the return type of type(s)? print ("abababbaababaaab".count("a",-12,-2))
|
|
101
|
The character used to indicate end of a block, is
|
|
102
|
What is the output of the given code snippet?(a = [0, 1, 2, 3]for a[0] in a: print(a[0]))
|
|
103
|
What is the output of the following code(i=5def f(a=i): print(a)i= 6f())
|
|
104
|
The format specifier which left aligns the value in Python 3, is
|
|
105
|
What is the output of the given code snippet?(x = 2for i in range(x): x += 1 print (x))
|
|
106
|
What will be the output of the given code snippet?(confusion = {}confusion[1] = 1confusion['1'] = 2confusion[1.0] = 4sum = 0for k in confusion: sum += confusion[k]print(sum))
|
|
107
|
What is the output of the given code snippet?(i = 0while i < 3: print(i) i += 1else: print(0))
|
|
108
|
What is the output of the given code snippet?(print('abcdefcdghcd'.split('cd', 2)))
|
|
109
|
What is the output of the given code snippet?(n=9while n!=0: print(n) n=n-2)
|
|
110
|
The local variable names beginning with an underscore that are discouraged are _____________________
|
|
111
|
What will be the output of the given code snippet?(d = {"john":40, "peter":45}"john" in d)
|
|
112
|
What will be the output of the given code snippet?(country_counter = {}def addone(country): if country in country_counter: country_counter[country] += 1 else: country_counter[country] = 1addone('China')addone('Japan')addone('china')print(len(country_counter)))
|
|
113
|
What is the output of the following code snippet?(def sum(*args): r = 0 for i in args: r += i return rprint(sum.__doc__)print(sum(1, 2))print(sum(1, 2, 3, 4)))
|
|
114
|
What is the shell prompt symbol usually in Linux
|
|
115
|
listExample is [3, 4, 5, 20, 5, 25, 1, 3], What is list1 after listExample.pop()?
|
|
116
|
Which of the given statements create a dictionary?
|
|
117
|
What is the output of the given code snippet?(x = [[0], [1]]print(len(' '.join(list(map(str, x))))))
|
|
118
|
The __________ function of dictionary gets all the keys from the dictionary.
|
|
119
|
Where do the arguments to functions always appear?
|
|
120
|
What is the output of the given code snippet?(x = ['ab', 'cd']print(list(map(list, x))))
|
|
121
|
The numeric value that an python variable can be assigned other than float and integer, is
|
|
122
|
What is the output of the given code snippet?(str = "Hello Python"str[3] = 'o'str[7] = 'i'print(str))
|
|
123
|
What is the output of the given code snippet?(i = 0while i < 5: print(i) i += 1 if i == 3: breakelse: print(0))
|
|
124
|
What will happen if no arguments are passed to the seek function?
|
|
125
|
What is the output of the given code snippet? (i = 5while True: if i%0O10 == 0: break print(i) i += 1)
|
|
126
|
Bitwise operator works on _______________ and performs _______________ operation, in Python.
|
|
127
|
What is the output of the given code snippet? (for i in range(int(float('inf'))): print (i))
|
|
128
|
Suppose list1 is [3, 5, 25, 1, 3], What is min(list1) ?
|
|
129
|
What is the output of the given code snippet?()x = (i for i in range(3))for i in x: print(i)
|
|
130
|
What is the output of the given code snippet? (for i in [1, 2, 3, 4, 5][::-2]: print (i))
|
|
131
|
What is the output of the given code snippet? (x = ['ab', 'cd']print(len(list(map(list, x)))))
|
|
132
|
To store values in terms of keys and value _______________ is used.
|
|
133
|
Which type of exception is raised when an operation or function is applied to an object of inappropriate type.
|
|
134
|
What is the output of the given code snippet? print('abcdefcdghcd'.split('cd',2))
|
|
135
|
Which parameter displays python version
|
|
136
|
What is the output of the given code snippet?
|
|
137
|
What is the output of following code?
|
|
138
|
What is the output of the below Python code?
|
|
139
|
What does the below code intended to do?
|
|
140
|
Which of the following functions print the output to the console?
|
|
141
|
Is the following statement correct?
|
|
142
|
What is the value of colors[2]?
|
|
143
|
What is the output of the following code?
|
|
144
|
Which of the following function checks that all characters of a string are in upper case?
|
|
145
|
Which function does in-place reversal of objects in a list?
|
|
146
|
What is the output of the following Python code?
|
|
147
|
Which module in Python supports regular expressions?
|
|
148
|
what should the below code print?
|
|
149
|
Which of the following environment variable for Python is an alternative module search path?
|
|
150
|
What would be the result of the following expression in Python?
|
|
151
|
If the following statement is run in Python, what will be the result?
|
|
152
|
If the following code is run in Python, what would be the result?
|
|
153
|
What does the function re.match do?
|
|
154
|
Which of the following lines of code will not show a match?
|
|
155
|
Which of the following functions does not accept any argument?
|
|
156
|
Which of the following statements regarding the output of the function re.match is incorrect?
|
|
157
|
Which of the following functions returns a dictionary mapping group names to group numbers?
|
|
158
|
In the functions re.search.start(group) and re.search.end(group), if the argument groups not specified, it defaults to ________
|
|
159
|
Which of the codes shown below results in a match?
|
|
160
|
Which of the following special characters matches a pattern only at the end of the string?
|
|
161
|
The special character \B matches the empty string, but only when it is ____________
|
|
162
|
The function of re.match is ____________
|
|
163
|
Which of the following pattern matching modifiers permits whitespace and comments inside the regular expression?
|
|
164
|
Which of the following functions creates a Python object?
|
|
165
|
The function of re.search is __________
|
|
166
|
The difference between the functions re.sub and re.subn is that re.sub returns a _______________ whereas re.subn returns a __________________
|
|
167
|
The function re.error raises an exception if a particular string contains no match for the given pattern.
|
|
168
|
Which of the following functions results in case insensitive matching?
|
|
169
|
Which of the following functions clears the regular expression cache?
|
|
170
|
Choose the function whose output can be: <_sre.SRE_Match object; span=(4, 8), match=’aaaa’>.
|
|
171
|
_______ matches the start of the string._______ matches the end of the string.
|
|
172
|
The expression a{5} will match _____________ characters with the previous regular expression.
|
|
173
|
The character Dot (that is, ‘.’) in the default mode, matches any character other than _____________
|
|
174
|
What happens if no arguments are passed to the seek function?
|
|
175
|
How do you change the file position to an offset value from the start?
|
|
176
|
How do you delete a file?
|
|
177
|
How do you rename a file?
|
|
178
|
How do you get the current position within the file?
|
|
179
|
How do you close a file object (fp)?
|
|
180
|
Which of the following is not a valid attribute of a file object (fp)?
|
|
181
|
How do you get the name of a file from a file object (fp)?
|
|
182
|
What is the difference between r+ and w+ modes?
|
|
183
|
Which of the following is not a valid mode to open a file?
|
|
184
|
Which of the following are the modes of both writing and reading in binary format in file?
|
|
185
|
Is it possible to create a text file in python?
|
|
186
|
Which function is used to close a file in python?
|
|
187
|
Which function is used to write a list of string in a file?
|
|
188
|
Which function is used to write all the characters?
|
|
189
|
Which function is used to read single line from file?
|
|
190
|
Which function is used to read all the characters?
|
|
191
|
What is the use of “a†in file handling?
|
|
192
|
What is the use of “w†in file handling?
|
|
193
|
In file handling, what does this terms means “r, a�
|
|
194
|
Correct syntax of file.readlines() is?
|
|
195
|
Correct syntax of file.writelines() is?
|
|
196
|
What is the correct syntax of open() function?
|
|
197
|
What is unpickling?
|
|
198
|
What is the pickling?
|
|
199
|
Which of the following mode will refer to binary data?
|
|
200
|
Which is/are the basic I/O connections in file?
|
|
201
|
What is the use of truncate() method in file?
|
|
202
|
What is the use of seek() method in files?
|
|
203
|
What is the current syntax of remove() a file?
|
|
204
|
What is the current syntax of rename() a file?
|
|
205
|
What is the use of tell() method in python?
|
|
206
|
Which one of the following is not attributes of file?
|
|
207
|
Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?
|
|
208
|
The readlines() method returns ____________
|
|
209
|
To read the remaining lines of the file from a file object infile, we use _________
|
|
210
|
To read the next line of the file from a file object infile, we use ____________
|
|
211
|
To read the entire remaining contents of the file as a string from a file object infile, we use ____________
|
|
212
|
To read two characters from a file object infile, we use ________
|
|
213
|
To open a file c:\scores.txt for appending data, we use _________
|
|
214
|
To open a file c:\scores.txt for writing, we use ____________
|
|
215
|
To open a file c:\scores.txt for reading, we use _____________
|
|
216
|
Which function overloads the // operator?
|
|
217
|
Which operator is overloaded by the __or__() function?
|
|
218
|
Let A and B be objects of class Foo. Which functions are called when print(A + B) is executed?
|
|
219
|
Which function overloads the >> operator?
|
|
220
|
Which operator is overloaded by __lg__()?
|
|
221
|
Which function overloads the == operator?
|
|
222
|
Which operator is overloaded by __invert__()?
|
|
223
|
Which function overloads the + operator?
|
|
224
|
Method issubclass() checks if a class is a subclass of another class.
|
|
225
|
Which of the following statements isn’t true?
|
|
226
|
What does single-level inheritance mean?
|
|
227
|
What does built-in function help do in context of classes?
|
|
228
|
Which of the following is not a type of inheritance?
|
|
229
|
What does built-in function type do in context of classes?
|
|
230
|
Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?
|
|
231
|
When defining a subclass in Python that is meant to serve as a subtype, the subtype Python keyword is used.
|
|
232
|
All subclasses are a subtype in object-oriented programming.
|
|
233
|
Which of the following statements is wrong about inheritance?
|
|
234
|
Which of the following best describes inheritance?
|
|
235
|
What does print(Test.__name__) display (assuming Test is the name of the class)?
|
|
236
|
__del__ method is used to destroy instances of a class.
|
|
237
|
What is delattr(obj,name) used for?
|
|
238
|
What is hasattr(obj,name) used for?
|
|
239
|
Special methods need to be explicitly called during object creation.
|
|
240
|
What are the methods which begin and end with two underscore characters called?
|
|
241
|
Which of the following is not a class method?
|
|
242
|
The assignment of more than one function to a particular operator is _______
|
|
243
|
What is Instantiation in terms of OOP terminology?
|
|
244
|
What is getattr() used for?
|
|
245
|
What is setattr() used for?
|
|
246
|
____ is used to create an object.
|
|
247
|
_____ represents an entity in the real world with its identity and behaviour.
|
|
248
|
Which of the following is false about protected class members?
|
|
249
|
The purpose of name mangling is to avoid unintentional access of private class members.
|
|
250
|
Private members of a class cannot be accessed.
|
|
251
|
Methods of a class that provide access to private members of the class are called as ______ and ______
|
|
252
|
Which of the following is the most suitable definition for encapsulation?
|
|
253
|
Which of these is not a fundamental features of OOP?
|
|
254
|
Overriding means changing behaviour of methods of derived class methods in the base class.
|
|
255
|
A class in which one or more methods are only implemented to raise an exception is called an abstract class.
|
|
256
|
What is the use of duck typing?
|
|
257
|
What is the biggest reason for the use of polymorphism?
|
|
258
|
Which of the following best describes polymorphism?
|
|
259
|
Which of the following blocks will be executed whether an exception is thrown or not?
|
|
260
|
______________________ exceptions are raised as a result of an error in opening a particular file.
|
|
261
|
An exception is ____________
|
|
262
|
Syntax errors are also known as parsing errors.
|
|
263
|
Which of the following is not a standard exception in Python?
|
|
264
|
Which of the following is not an exception handling keyword in Python?
|
|
265
|
What happens when ‘1’ == 1 is executed?
|
|
266
|
When is the finally block executed?
|
|
267
|
Can one block of except statements handle multiple exception?
|
|
268
|
When will the else part of try-except-else be executed?
|
|
269
|
How many except statements can a try-except block have?
|
|
270
|
To which of the following the “in†operator can be used to check if an item is in it?
|
|
271
|
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
|
|
272
|
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
|
|
273
|
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])?
|
|
274
|
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
|
|
275
|
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?
|
|
276
|
Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
|
|
277
|
To remove string “hello†from list1, we use which command?
|
|
278
|
To insert 5 to the third position in list1, we use which command?
|
|
279
|
o add a new element to a list we use which command?
|
|
280
|
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
|
|
281
|
Suppose list1 is [1, 3, 2], What is list1 * 2?
|
|
282
|
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
|
|
283
|
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
|
|
284
|
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
|
|
285
|
To shuffle the list(say list1) what function do we use?
|
|
286
|
Suppose list1 is [1, 5, 9], what is sum(list1)?
|
|
287
|
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
|
|
288
|
Suppose list1 is [2445,133,12454,123], what is max(list1)?
|
|
289
|
Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
|
|
290
|
What is the output when we execute list(“helloâ€)?
|
|
291
|
Which of the following commands will create a list?
|
|
292
|
Suppose x is 345.3546, what is format(x, “10.3fâ€) (_ indicates space).
|
|
293
|
What function do you use to read a string?
|
|
294
|
Suppose i is 5 and j is 4, i + j is same as _______
|
|
295
|
To check whether string s1 contains another string s2, use ________
|
|
296
|
If a class defines the __str__(self) method, for an object obj for the class, you can use which command to invoke the __str__ method.
|
|
297
|
To return the length of string s what command do we execute?
|
|
298
|
To retrieve the character at index 3 from string s=â€Hello†what command do we execute (multiple answers allowed)?
|
|
299
|
What is “Helloâ€.replace(“lâ€, “eâ€)?
|
|
300
|
Say s=â€hello†what will be the return value of type(s)?
|
|
301
|
What will be displayed by print(ord(‘b’) – ord(‘a’))?
|
|
302
|
What will be the output of the “hello†+1+2+3?
|
|
303
|
The format function, when applied on a string returns __________
|
|
304
|
Suppose s is “\t\tWorld\nâ€, what is s.strip()?
|
|
305
|
Which of the following statement prints hello\example\test.txt?
|
|
306
|
To concatenate two strings to a third what statements are applicable?
|
|
307
|
Given a string example=â€hello†what is the output of example.count(‘l’)?
|
|
308
|
print(0xA + 0xB + 0xC):
|
|
309
|
What arithmetic operators cannot be used with strings?
|
|
310
|
The output of executing string.ascii_letters can also be achieved by:
|
|
311
|
What will be the output of the following Python statement?(>>>"abcd"[2:])
|
|
312
|
What will be the output of the following Python statement?(>>>"a"+"bc")
|
|
313
|
A function with parameters cannot be decorated.
|
|
314
|
The ______ symbol along with the name of the decorator function can be placed above the definition of the function to be decorated works as an alternate way for decorating a function.
|
|
315
|
Is Tuple mutable?
|
|
316
|
Which of the following has more precedance?
|
|
317
|
. class test: def __init__(self): print "Hello World" def __init__(self): print "Bye World" obj=test()
|
|
318
|
Python allows string slicing. What is the output of below code: s='cppbuzz chicago' print(s[3:5])
|
|
319
|
Select the reserved keyword in python-
|
|
320
|
Which Of The Following Keywords Mark The Beginning Of The Class Definition?
|
|
321
|
What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))
|
|
322
|
Writing to STDOUT and STDERR is fairly inflexible, and most of the time the print statement accomplishes the same purpose more flexibly. How many arguments can a print statement handle?
|
|
323
|
Which user input method will act like a file-object on which read and readline functions can be called?
|
|
324
|
Which Python module can be used for copying files?
|
|
325
|
Which of the following will throw an exception in Python?
|
|
326
|
Which of the following will disable output buffering in Python?
|
|
327
|
Which of the following will determine the number of CPUs available in the operating environment?
|
|
328
|
Which of the following variables store parameters passed from outside?
|
|
329
|
Which of the following statements imports every name in a module namespace into the current namespace?
|
|
330
|
Which of the following statements copy the contents of a list and not just a reference to the list?
|
|
331
|
Which of the following statements can be used to remove an item from a list by giving the index?
|
|
332
|
Which of the following statements are true? A. ._variable is semi-private and meant just for convention. B. .__variable is considered superprivate and gets name mangled to prevent accidental acces...
|
|
333
|
Which of the following protocol libraries can be used for an email implementation in a Python application?
|
|
334
|
Which of the following options are true regarding these two code samples? Code sample 1: def main(): for i in xrange(10**8): pass main() Code sample 2: for i in xrange(10**8): pass
|
|
335
|
Which of the following modules lets you check whether two files are identical, and whether two directories contain some identical files?
|
|
336
|
Which of the following modules keep prior directory listings in the memory to avoid the need for a new call to the file system?
|
|
337
|
Which of the following modules is used internally to determine whether a path matches?
|
|
338
|
Which of the following methods returns the ASCII value of a character in Python?
|
|
339
|
Which of the following members of the object class compare two parameters?
|
|
340
|
Which of the following is the correct way to write a generator which will output the numbers between 1 and 100 (inclusive)?
|
|
341
|
Which of the following is the correct way to get the size of a list in Python?
|
|
342
|
Which of the following is the correct way to flush output of Python print?
|
|
343
|
Which of the following is the correct way to execute a program from inside Python without having to consider how the arguments/quotes are formatted?
|
|
344
|
Which of the following is the correct way to check to see if the variable theVar is an integer?
|
|
345
|
Which of the following is the correct way to call the private method, myPrivateMethod(), in class MyClass, using dir(obj)? class MyClass: def __myPrivateMethod(self): print &quot;Private Me...
|
|
346
|
Which of the following is the correct prototype of the string.find() function?
|
|
347
|
Which of the following is the correct prototype for the &#39;open&#39; function of the file class in python 2.2+?
|
|
348
|
Which of the following is the correct method for changing a global variable inside a function?
|
|
349
|
Which of the following is the best way to reverse the string &#39;Test String&#39; in Python?
|
|
350
|
Which of the following is the best method to find the indices of all occurances of a word in a string? line = &#39;mary had a little lamb, little lamb, little lamb&#39; word = &#39;lamb&#39;
|
|
351
|
Which of the following is the base class for new-style file objects?
|
|
352
|
Which of the following is a way to find a local computer&#39;s IP address with Python?
|
|
353
|
Which of the following functions modifies the list in place to indicate which items are directories, and which are plain files?
|
|
354
|
Which of the following functions is used to send audio data via the Internet?
|
|
355
|
Which of the following functions can change the maximum level of recursion?
|
|
356
|
Which of the following exceptions occurs while importing a module?
|
|
357
|
Which of the following commands would produce the following result: result: &#39;line 1
line 2&#39;
|
|
358
|
Which of the following code snippets concatenates the list a_list = [1, 2, 3] with the tuple a_tuple = (4, 5), so the result would be [1, 2, 3, 4, 5]?
|
|
359
|
Which of the following are the main features of Python?
|
|
360
|
Which list flattening method will have the shortest running time?
|
|
361
|
Which is the correct way to remove an installed Python package?
|
|
362
|
Which is not used to install Python packages?
|
|
363
|
Which function could be used to list every file and folder in the current directory?
|
|
364
|
When is the &quot;yield&quot; keyword used in Python?
|
|
365
|
What would the &#39;sorted_tel&#39; be in the following code: tel = {&#39;jack&#39;: 4098, &#39;sape&#39;: 5139, &#39;bill&#39;: 3678, &#39;mike&#39;: 2122} sorted_tel = sorted(tel.items(), key=lambda x: x[1])
|
|
366
|
What will be the output of the following statements: &gt;&gt;&gt; import string &gt;&gt;&gt; string.ljust(width=30,s=&quot;Mary had a little lamb&quot;)
|
|
367
|
What is the result of the following code: &gt;&gt;&gt; import itertools &gt;&gt;&gt; x = itertools.count(0) &gt;&gt;&gt; x.__class__.__name__
|
|
368
|
What is the output of the following code? def foo(param1, *param2): print param1 print param2 def bar(param1, **param2): print param1 print param2 foo(1,2,3,4,5) bar(1,a=2,b=3)
|
|
369
|
What is the output of the following code: name = &#39;Jon&#39; name.rjust(4, &#39;A&#39;)
|
|
370
|
What is the most flexible way to call the external command &quot;ls -l&quot; in Python?
|
|
371
|
What is the correct way to delete a directory that is not empty using Python?
|
|
372
|
What is the best way to check if the object &#39;myobject&#39; is iterable in Python?
|
|
373
|
What is a metaclass in Python?
|
|
374
|
Various email and news clients store messages in a variety of formats, many providing hierarchical and structured folders. Which of the following provides a uniform API for reading the messages sto...
|
|
375
|
The most important element of the email package is the message. The email class provides the classes for messages in Python. Which of the following classes is used for the message?
|
|
376
|
The least sophisticated form of text output in Python is writing to open files. In particular, which of the following streams can be used?
|
|
377
|
The core text processing tasks in working with email are parsing, modifying, and creating the actual messages. Which of the following modules deal with parsing and processing email messages?
|
|
378
|
Read the following statements: Statement 1: Many string module functions are now also available as string object methods. Statement 2: To use string object methods, there is no need to import the...
|
|
379
|
Read the following statements: Statement 1: A simple assignment statement binds a name into the current namespace, unless that name has been declared as global. Statement 2: A name declared as gl...
|
|
380
|
Read the following statements: &gt;&gt;&gt; word = &#39;Help&#39; + &#39;A&#39; &gt;&gt;&gt; &#39;&lt;&#39; + word*5 + &#39;&gt;&#39; Which of the following will be the output of the above code snippet?
|
|
381
|
Read the following statements: &gt;&gt;&gt; lst = [&#39;spam&#39;,&#39;and&#39;,&#39;eggs&#39;] &gt;&gt;&gt; lst[2] = &#39;toast&#39; &gt;&gt;&gt; print &#39;&#39;.join(lst) &gt;&gt;&gt; print &#39; &#39;.join(lst) Which of the following is the output of the second print stateme...
|
|
382
|
Read the following statements: &gt;&gt;&gt; import string &gt;&gt;&gt; s = &#39;mary 11had a little lamb&#39; &gt;&gt;&gt; print s Which of the following will be the output of the above code snippet?
|
|
383
|
Read the following statements: &gt;&gt;&gt; import array &gt;&gt;&gt; a = array.array(&#39;c&#39;,&#39;spam and eggs&#39;) &gt;&gt;&gt; a[0] = &#39;S&#39; &gt;&gt;&gt; a[-4:] = array.array(&#39;c&#39;,&#39;toast&#39;) &gt;&gt;&gt; print &#39;&#39;.join(a) Which of the following will be t...
|
|
384
|
One common way to test a capability in Python is to try to do something, and catch any exceptions that occur. Which of the following is the correct mechanism of trapping an error?
|
|
385
|
Object is the base class of new-style datatypes. Which of the following functions is not a member of the object class?
|
|
386
|
It is possible to use encoding other than ASCII in Python source files. The best way to do it is to put one more special comment line right after the #! line to define the source file encoding. Whi...
|
|
387
|
Inheriting from a base class enables a custom class to use a few new capabilities, such as slots and properties. Which of the following is the base class of new-style datatypes?
|
|
388
|
In Python, what is the default maximum level of recursion?
|
|
389
|
In Python, built-in exceptions can be inherited from. Which of the following is the base exception class?
|
|
390
|
In Python 2.x, which of the following is the way to check to make sure that the variable &#39;x&#39; is not a string?
|
|
391
|
How many arguments can a print statement handle?
|
|
392
|
How can an element be removed from a list using its list index?
|
|
393
|
How can a numeric String (eg. &quot;545.2222&quot;) be converted to Float or Integer?
|
|
394
|
How can a null object be declared in Python?
|
|
395
|
How can a list be split into equal sized chunks?
|
|
396
|
Given a program that saved a text file in the directory &quot;/temp_files&quot;, which of the following will make sure that &quot;/temp_files&quot; exists before writing the file?
|
|
397
|
Examine the following prototype for the &#39;open&#39; function of the file class in Python 2.2+: open(fname [,mode [,buffering]]) Which of the following is correct for the &#39;buffering&#39; argument?
|
|
398
|
What will be the output of 7^10 in python?
|
|
399
|
What is the maximum possible length of an identifier?
|
|
400
|
Which statement is correct....??
|
|
401
|
Which of the following data types is not supported in python ?
|
|
402
|
Mathematical operations can be performed on a string. State whether true or false -
|
|
403
|
Consider the results of a medical experiment that aims to predict whether someone is going to develop myopia based on some physical measurements and heredity. In this case, the input dataset consists of the person’s medical characteristics and the target variable is binary: 1 for those who are likely to develop myopia and 0 for those who aren’t. This can be best classified as
|
|
404
|
time.time() returns ________
|
|
405
|
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
|
|
406
|
What is called when a function is defined inside a class?
|
|
407
|
What is the output of the following segment : chr(ord('A'))
|
|
408
|
What is the output of the following code :
|
|
409
|
What will be the output of the following code : print type(type(int))
|
|
410
|
The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field.
|
|
411
|
The output of which of the codes shown below will be: “There are 4 blue birds.�
|
|
412
|
Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
|
|
413
|
Which of the following Boolean expressions is not logically equivalent to the other three?
|
|
414
|
What is the two’s complement of -44?
|
|
415
|
Which of the following expressions can be used to multiply a given number ‘a’ by 4?
|
|
416
|
Any odd number on being AND-ed with ________ always gives 1. Hint: Any even number on being AND-ed with this value always gives 0.
|
|
417
|
Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1.
|
|
418
|
The one’s complement of 110010101 is:
|
|
419
|
It is not possible for the two’s complement value to be equal to the original value in any case.
|
|
420
|
Which one of the following is not a python's predefined data type?
|
|
421
|
The format function, when applied on a string returns :
|
|
422
|
class test: def __init__(self): print "Hello World" def __init__(self): print "Bye World" obj=test()
|
|
423
|
Python allows string slicing. What is the output of below code: s='cppbuzz chicago' print(s[3:5])
|
|
424
|
Are nested if-else are allowed in Python?
|
|
425
|
Select the reserved keyword in python-
|
|
426
|
Which Of The Following Keywords Mark The Beginning Of The Class Definition?
|
|
427
|
Which of the following data types is not supported in python ?
|
|
428
|
What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))
|
|
429
|
What is the return type of function id?
|
|
430
|
Which one of the following has the highest precedence in the expression?
|
|
431
|
Mathematical operations can be performed on a string. State whether true or false.
|
|
432
|
All keywords in Python are in
|
|
433
|
Which of the following is the use of id() function in python?
|
|
434
|
Python was released publicly in
|
|
435
|
Extensible programming language that can be extended through classes and programming interfaces is
|
|
436
|
Python is said to be easily
|
|
437
|
The expression 2**2**3 is evaluates as: (2**2)**3.
|
|
438
|
Which of the following expressions results in an error?
|
|
439
|
Which of the following expressions is an example of type conversion?
|
|
440
|
What will be the output of the following Python expression?
|
|
441
|
Which of the following expressions involves coercion when evaluated in Python?
|
|
442
|
Which of the following is the truncation division operator?
|
|
443
|
Which of the following operators has its associativity from right to left?
|
|
444
|
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same.
|
|
445
|
What does 3 ^ 4 evaluate to?
|
|
446
|
What is the result of round(0.5) – round(-0.5)?
|
|
447
|
What is the result of cmp(3, 1)?
|
|
448
|
Which of the following is incorrect?
|
|
449
|
What does ~~~~~~5 evaluate to?
|
|
450
|
What does ~4 evaluate to?
|
|
451
|
What is the type of inf?
|
|
452
|
Which of the following is not a complex number?
|
|
453
|
What is the output of print 0.1 + 0.2 == 0.3?
|
|
454
|
What is the return value of trunc()?
|
|
455
|
Which of the following results in a SyntaxError?
|
|
456
|
In order to store values in terms of key and value we use what core data type.
|
|
457
|
What is the return type of function id?
|
|
458
|
Which of the following will run without errors?
|
|
459
|
Given a function that does not return any value, What value is thrown by default when executed in shell
|
|
460
|
Which of these in not a core data type?
|
|
461
|
Which one of the following has the highest precedence in the expression?
|
|
462
|
he expression Int(x) implies that the variable x is converted to integer.
|
|
463
|
Which one of the following has the same precedence level?
|
|
464
|
What is the output of this expression, 3*1**3?
|
|
465
|
Operators with the same precedence are evaluated in which manner?
|
|
466
|
Mathematical operations can be performed on a string.
|
|
467
|
What is the answer to this expression, 22 % 3 is?
|
|
468
|
Which one of these is floor division?
|
|
469
|
Which is the correct operator for power(xy)?
|
|
470
|
Which of the following cannot be a variable?
|
|
471
|
Which of the following is true for variable names in Python?
|
|
472
|
All keywords in Python are in _________
|
|
473
|
Which of the following is not a keyword?
|
|
474
|
Why are local variable names beginning with an underscore discouraged?
|
|
475
|
Which of the following is an invalid variable?
|
|
476
|
Which of the following is invalid?
|
|
477
|
Is Python case sensitive when dealing with identifiers?
|
|
478
|
Is Tuple mutable?
|
|
479
|
what is the output for: name="Hello World" print(type(name))
|
|
480
|
Select the command to Find and print Data types using the Type command. name="Hello World"
|
|
481
|
Which of the following variable is invalid?
|
|
482
|
Is Python case sensitive?
|
|
483
|
Which of the following has more precedance?
|
|
484
|
What is the associativity of Operators with the same precedence?
|
|
485
|
19 % 2 in python
|
|
486
|
Which of the following operators is used to get accurate result (i.e fraction part also) in case of division ?
|
|
487
|
Select the correct code to print cppbuzz-chicago
|
|
488
|
Which of the following data type is used to store values in Key & Value format?
|
|
489
|
What is the data type of X in X = [12.12, 13, 'cppbuzz']
|
|
490
|
Is it possible to use round function without any argument like round()
|
|
491
|
How following evaluates in Python? round(0.5) – round(-0.5)
|
|
492
|
What will be the output of 7^10 in python?
|
|
493
|
Which one of the following is not a python's predefined data type?
|
|
494
|
To open a file c:cppbuzz.txt for writing, we use
|
|
495
|
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ?
|
|
496
|
Which of the following is an invalid statement?
|
|
497
|
What is the maximum possible length of an identifier?
|
|
498
|
Which statement is correct....??
|
|
499
|
print(chr(ord('b')+1))
|
|
500
|
The format function, when applied on a string returns :
|
|
501
|
If a='cpp', b='buzz' then which of the following operation would show 'cppbuzz' as output?
|
|
502
|
What is correct syntax to copy one list into another?
|
|
503
|
How to find the last element of list in Python? Assume `bikes` is the name of list.
|
|
504
|
Syntax of constructor in Python?
|
|
505
|
Which predefined Python function is used to find length of string?
|
|
506
|
Which of the following is correct way to declare string variable in Python?
|
|
507
|
Which keyword is used to define methods in Python?
|
|
508
|
Which of the following symbols are used for comments in Python?
|
|
509
|
Select the reserved keyword in python
|