Here are 10 more Python multiple-44
Here are 10 more Python multiple-44
x = {1, 2, 3, 4}
x.add(5)
print(x)
a) {1, 2, 3, 4}
b) {1, 2, 3, 4, 5}
c) [1, 2, 3, 4, 5]
d) Error
Answer: b) {1, 2, 3, 4, 5}
a) (1,)
b) (1)
c) [1]
d) tuple(1)
Answer: a) (1,)
3 * "Python"
a) PythonPythonPython
b) Python * 3
c) Error
d) 3Python
Answer: a) PythonPythonPython
a) list
b) set
c) tuple
d) dictionary
Answer: c) tuple
a = 10
b = 20
print(a == b)
a) True
b) False
c) Error
d) None
Answer: b) False
a)
while True:
pass
b)
while 1:
pass
c) Both a and b
d) Python does not support infinite loops
a) round()
b) max()
c) min()
d) sort()
Answer: d) sort()
(Explanation: sort() is a method of lists, not a standalone function.)
9. What will the following code print?
print(2 in x)
a) True
b) False
c) Error
d) None
Answer: a) True
a = 10
b=5
print(a // b)
a) 2.0
b) 2
c) 2.5
d) Error
Answer: b) 2