Python Online Quiz - Part -1
Our Python Online Quiz is an individual for various tests and interviews. Questions have detailed problem descriptions and solutions with detailed explanations so that one can understand them easily.
1. Which of the following is not a core data type in Python programming?
Correct Answer
Wrong Answer
2. What will be the output of the following Python function?
len(["hello",2, 4, 6])
Correct Answer
Wrong Answer
3. What will be the value of ‘result’ in following Python program?
list1 = [1,2,3,4] list2 = [2,4,5,6] list3 = [2,6,7,8] result = list() result.extend(i for i in list1 if i not in (list2+list3) and i not in result) result.extend(i for i in list2 if i not in (list1+list3) and i not in result) result.extend(i for i in list3 if i not in (list1+list2) and i not in result)
Correct Answer
Wrong Answer
4. What will be the output of the following Python program?
i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0)
Correct Answer
Wrong Answer
5. What is output of print(math.pow(3, 2))?
Correct Answer
Wrong Answer
6. What will be the output of the following Python code?
def foo(): try: return 1 finally: return 2 k = foo() print(k)
Correct Answer
Wrong Answer
7. What will be the output of the following Python code?
print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
Correct Answer
Wrong Answer
8. What will be the output of the following Python program?
-
def addItem(listParam):
-
listParam += [1]
-
-
mylist = [1, 2, 3, 4]
-
addItem(mylist)
-
print(len(mylist))
Correct Answer
Wrong Answer
9. What will be the output of the following Python code?
x = 'abcd' for i in range(len(x)): print(i)
Correct Answer
Wrong Answer
10. What will be the output of the following Python program?
def foo(x): x[0] = ['def'] x[1] = ['abc'] return id(x) q = ['abc', 'def'] print(id(q) == foo(q))