MCQ Type
MCQ Type
x = [1, 2, 3]
y=x
x = x + [4, 5]
print(y)
a. [1, 2, 3, 4, 5]
b. [1, 2, 3]
c. Error
d. None
b.append(a)
return b
a. [1], [2]
b. [1], [1, 2]
c. [2], [1, 2]
d. [1, 2], [1, 2]
a = [1, 2, 3]
b = a[:]
a[0] = 100
print(b[0])
a. 100
b. 1
c. Error
d. None
a. True
b. False
c. [0, 1, 2]
d. Error
x = "hello"
y=x
x = "world"
print(y)
a. hello
b. world
c. None
d. Error
10. In file handling, what happens if we open a file with mode 'w'?
a. Reads the file
b. Appends to file
c. Overwrites file if exists
d. Raises error if file exists
a += b
return a
s = {1, 2, 3}
s.add([4, 5])
What happens?
y.append(x)
return y
print(g(1))
print(g(2))
a. [1] [2]
b. [1] [1, 2]
c. [1, 2] [1, 2]
d. Error
print(type((1)))
print(type((1,)))
a. int, int
b. tuple, int
c. int, tuple
d. tuple, tuple
18. Which of the following modules is NOT part of Python standard library?
a. math
b. os
c. random
d. numpy