Which of the following is the output of the below Python code?
def myfunc(): try: print('Monday') finally: print('Tuesday') myfunc()Answer
Which of the following is the correct output of the call to below line of code?
print(list("hello"))Answer
Determine the output of the below Python code fragment?
var1 = True var2 = False var3 = False if var1 or var2 and var3: print("True") else: print("False")Answer
Which of the following is the output of the instructions mentioned below?
def test1(param): return str(param) def test2(param): return str(2 * param) result = test1(1) + test2(2) print(result)Answer
Which of the following is the output of the below Python code?
def test1(param): return param def test2(param): return param * 2 def test3(param): return param + 3 result = test1(test2(test3(1))) print(result)Answer
Which of the following is the output of the below Python code?
def test(): try: return 1 finally: return 2 result = test() print(result)Answer
Which of the following statements would create an instance of Ubuntu class correctly?
class Ubuntu: def __init__(self, ramsize): self.ram = ramsize self.type = 'server'Answer
Which of the following is the output of the below Python code?
test_list = [1, 5, 5, 5, 5, 1] max = test_list[0] indexOfMax = 0 for i in range(1, len(test_list)): if test_list[i] > max: max = test_list[i] indexOfMax = i print(indexOfMax)Answer
What is the output of the following code snippet?
print type([1,2])Answer
Which of the following is the output of the below Python code?
def f(): pass print(type(f()))Answer
Which of the following is the output of the below Python code?
def Test(): try: print(20) finally: print(30) Test()Answer
Which of the following is the output of the following Python code?
print(type(lambda:None))Answer
Say test_list is [3, 4, 5, 20, 5, 25, 1, 3] then what would be the value of test_list after test_list.pop(1)?
AnswerThe x % y operator can be used to check for even or odd numbers.
Here, we need to verify an even number so complete the below condition?
if _______: print("x is an even number")Answer
Which of the following is the output of the below Python code?
try: print("throw") except: print("except") finally: print("finally")Answer
Fill in the missing part of the code to print the following patterns:
5 5 5 5 5
4 4 4 4 4
3 3 3 3 3
2 2 2 2 2
1 1 1 1 1
for i in range(5, 0, ____ ): print(str(i) * 5)Answer
What does the following code do?
def a(b, c, d): passAnswer
What is the output of the below code fragment?
[Python version 2.x]
print type(1/2)Answer
Which of the following literals is not valid to be a function name?
AnswerWhich of the following is the output of the below Python code fragment?
d = lambda p: p * 2 t = lambda p: p * 3 x = 2 x = d(x) x = t(x) x = d(x) print(x)Answer
© 2017 QuizBucket.org