Top 50+ Solved Python Programming MCQ Questions Answer
Q. What is the output of the following?elements = [0, 1, 2]def incr(x): return x+1print(list(map(elements, incr)))
a. [1, 2, 3].
b. [0, 1, 2].
c. error
d. none of the mentioned
Q. What is the output of the following?elements = [0, 1, 2]def incr(x): return x+1print(list(map(incr, elements)))
a. [1, 2, 3].
b. [0, 1, 2].
c. error
d. none of the mentioned
Q. What is the output of the following?x = ['ab', 'cd']print(len(list(map(list, x))))
a. 2
b. 4
c. error
d. none of the mentioned
Q. Program code making use of a given module is called a ______ of the module.
a. Client
b. Docstring
c. Interface
d. Modularity
Q. What is the output of the following piece of code?#mod1def change(a): b=[x*2 for x in a] print(b)#mod2def change(a): b=[x*x for x in a] print(b)from mod1 import changefrom mod2 import change#mains=[1,2,3]change(s)
a. [2,4,6].
b. [1,4,9].
c. [2,4,6].
d. There is a name clash
Q. What is the output of the following program? tday=datetime.date.today()print(tday.month())
a. August
b. Aug
c. 08
d. 8
Q. To read the entire remaining contents of the file as a string from a file object infile, we use
a. infile.read(2)
b. infile.read()
c. infile.readline()
d. infile.readlines()
Q. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a. print(t[3])
b. t[3] = 45
c. print(max(t))
d. print(len(t))