What is the output of the following code? Consider Python 2.7.
print tuple[1:3] if tuple == ( 'abcd', 786 , 2.23, 'john', 70.2 ) else tuple()
Answer
What will be displayed by the following code?
def f(value, values):
v = 1
values[0] = 44
t = 3
v = [1, 2, 3]
f(t, v)
print(t, v[0])
Answer
What is the output of the following program :
print 'abcefd'.replace('cd', '12')
Answer
What is the output of the following program :
print 'abef'.partition('cd')
Answer
What is the output of the following program :
print 'cd'.partition('cd')
Answer
What is the output of the following program :
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
Answer
What is the output of the following program :
i = 0
while i < 3:
print i
i += 1
else:
print 0
Answer
What is the output of the following program :
print '{0:-2%}'.format(1.0 / 3)
Answer
What is the output of the following program :
print '{0:.2}'.format(1.0 / 3)
Answer
What is the output of the expression : 3*1**3
AnswerWhat is the output of the following program :
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
Answer
Which of the following statement(s) is TRUE?
A hash function takes a message of arbitrary length and generates a fixed length code.
A hash function takes a message of fixed length and generates a code of variable length.
A hash function may give the same hash value for distinct messages.
Which of the following function convert a string to a float in python?
AnswerWhat data type is the object below ? L = [1, 23, ‘hello’, 1]
AnswerWhich of these is not a core data type?
AnswerWhich of the following is correct about Python?
AnswerTo start Python from the command prompt, use the command ______
Answer____is a simple but incomplete version of a function.
AnswerGiven a string s = “Welcome”, which of the following code is incorrect?
AnswerWhat does ~~~~~~5 evaluate to?
Answer© 2017 QuizBucket.org