Home / Programming Questions / Python MCQs / Page 5

Python MCQs with answers Page - 5

Dear candidates you will find MCQ questions of Python here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

R

Ram Sharma • 178.09K Points
Coach

Q. What is the length of sys.argv?

(A) number of arguments
(B) number of arguments + 1
(C) number of arguments – 1
(D) none of the mentioned

R

Ram Sharma • 178.09K Points
Coach

Q. What is the output of the following code?

Code:
def foo(k):
k[0] = 1
q = [0]
foo(q)
print(q)
(A) [0].
(B) [1].
(C) [1, 0].
(D) [0, 1].

R

Ram Sharma • 178.09K Points
Coach

Q. What is the output of the following code?

Code:
def foo(fname, val):
print(fname(val))
foo(max, [1, 2, 3])
foo(min, [1, 2, 3])
(A) 3 1
(B) 1 3
(C) error
(D) none of the mentioned

R

Ram Sharma • 178.09K Points
Coach

Q. What is the output of the following?

Code:
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(elements, incr)))
(A) [1, 2, 3].
(B) [0, 1, 2].
(C) error
(D) none of the mentioned

R

Ram Sharma • 178.09K Points
Coach

Q. What is the output of the following?

Code:
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(incr, elements)))
(A) [1, 2, 3].
(B) [0, 1, 2].
(C) error
(D) none of the mentioned

R

Ram Sharma • 178.09K Points
Coach

Q. What is the output of the following?

Code:
def to_upper(k):
return k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))
(A) [„AB?, „CD?].
(B) [„ab?, „cd?].
(C) none of the mentioned
(D) error

R

Ram Sharma • 178.09K Points
Coach

Q. What is the output of the following?

Code:
x = ['ab', 'cd']
print(len(list(map(list, x))))
(A) 2
(B) 4
(C) error
(D) none of the mentioned

R

Ram Sharma • 178.09K Points
Coach

Q. Program code making use of a given module is called a ______ of the module.

(A) Client
(B) Docstring
(C) Interface
(D) Modularity

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.