1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
https://www.sanfoundry.com/1000-python-questions-answers/ 1/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
Python Precedence 4. Which of the following is the correct extension of the Python file?
Associativity - Set 2 a) .python
b) .pl
Python Bitwise - Set 1 c) .py
d) .p
Python Bitwise - Set 2
View Answer
Python Boolean
Python Advance
Formatting
Python Decorators
Python MCQ - Strings 7. Which of the following is used to define a block of code in Python
language?
Python MCQ - Lists
a) Indentation
Python MCQ - List b) Key
Comprehension c) Brackets
d) All of the mentioned
Python MCQ - Tuples View Answer
Python MCQ - Sets
8. Which keyword is used for function in Python language?
Python MCQ - a) Function
Dictionary b) Def
c) Fun
Python MCQ - Built- d) Define
in Functions
View Answer
Python MCQ -
Functions 9. Which of the following character is used to give single-line comments in
Python?
Python MCQ - a) //
Argument Passing, b) #
Variables & c) !
Recursion
https://www.sanfoundry.com/1000-python-questions-answers/ 3/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
Python MCQ - d) /*
Mapping Functions View Answer
Python MCQ -
10. What will be the output of the following Python code?
Modules
Python MCQ - i = 1
if i%3 == 0:
print(i)
Python MCQ -
Internship Test
a) 4
Job Test b) 2
c) 1
Qualifier Test
d) 8
Top Rankers View Answer
Practice Test - Chapter 1
Practice Test - Chapter 2
https://www.sanfoundry.com/1000-python-questions-answers/ 5/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
Mock Test - Chapter 9 19. Which of the following is the truncation division operator in Python?
a) |
Mock Test - Chapter 10
b) //
c) /
https://www.sanfoundry.com/1000-python-questions-answers/ 6/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
d) %
View Answer
list(filter(bool, l))
23. The following python program can work with ____ parameters.
https://www.sanfoundry.com/1000-python-questions-answers/ 7/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
def f(x):
print("Sanfoundry")
return f1
a) any number of
b) 0
c) 1
d) 2
View Answer
min(max(False,-3,-4), 2,7)
a) -4
b) -3
c) 2
d) False
View Answer
25. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary
View Answer
https://www.sanfoundry.com/1000-python-questions-answers/ 8/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
print("%.2f"%x)
a) 56.236
b) 56.23
c) 56.0000
d) 56.24
View Answer
len(["hello",2, 4, 6])
a) Error
b) 6
c) 4
d) 3
View Answer
https://www.sanfoundry.com/1000-python-questions-answers/ 9/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
x = 'abcd'
for i in x:
print(i.upper())
a) a B C D
b) a b c d
c) error
d) A B C D
View Answer
31. What will be the output of the following Python code snippet?
print (i)
a) 4 3 2 1
b) error
c) 1 2 3 4
https://www.sanfoundry.com/1000-python-questions-answers/ 10/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
1. >>>"a"+"bc"
a) bc
b) abc
c) a
d) bca
View Answer
f = foo()
format(f)
a) str()
b) format()
c) __str__()
d) __format__()
View Answer
https://www.sanfoundry.com/1000-python-questions-answers/ 11/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
d) nonlocal
View Answer
1. class tester:
2. def __init__(self, id):
3. self.id = str(id)
4. id="224"
5.
6. >>>temp = tester(12)
7. >>>print(temp.id)
a) 12
b) 224
c) None
d) Error
View Answer
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))
a) Error
b) None
c) False
https://www.sanfoundry.com/1000-python-questions-answers/ 12/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
d) True
View Answer
37. Which module in the python standard library parses options received
from the command line?
a) getarg
b) getopt
c) main
d) os
View Answer
z=set('abc')
z.add('san')
z.update(set(['p', 'q']))
print("abc. DEF".capitalize())
a) Abc. def
b) abc. def
c) Abc. Def
d) ABC. DEF
View Answer
list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
a) [1, 3, 5, 7, 8]
b) [1, 7, 8]
https://www.sanfoundry.com/1000-python-questions-answers/ 14/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
c) [1, 2, 4, 7, 8]
d) error
View Answer
a) * abcde *
b) *abcde *
c) * abcde*
d) * abcde *
View Answer
1. >>>list1 = [1, 3]
2. >>>list2 = list1
3. >>>list1[0] = 4
4. >>>print(list2)
a) [1, 4]
b) [1, 3, 4]
https://www.sanfoundry.com/1000-python-questions-answers/ 15/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
c) [4, 3]
d) [1, 3]
View Answer
47. Which of the following Python statements will result in the output: 6?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
a) A[2][1]
b) A[1][2]
c) A[3][2]
d) A[2][3]
View Answer
https://www.sanfoundry.com/1000-python-questions-answers/ 16/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
https://www.sanfoundry.com/1000-python-questions-answers/ 18/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
Python MCQ: While & For Python MCQ: While & For
Loops – 1 Loops – 4
Python MCQ: While & For Python MCQ: While & For
Loops – 2 Loops – 5
Python MCQ: While & For Python MCQ: While & For
Loops – 3 Loops – 6
https://www.sanfoundry.com/1000-python-questions-answers/ 19/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
https://www.sanfoundry.com/1000-python-questions-answers/ 20/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
Wish you the best in your endeavor to learn and master Python!
Important Links:
Java Multiple Choice Questions
C++ Multiple Choice Questions
C Multiple Choice Questions
C# Multiple Choice Questions
Data Structures Multiple Choice Questions
Computer Science Multiple Choice Questions
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is
Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN
Architect and is passionate about competency developments in these
areas. He lives in Bangalore and delivers focused training sessions to IT
professionals in Linux Kernel, Linux Debugging, Linux Device Drivers,
Linux Networking, Linux Storage, Advanced C Programming, SAN Storage
https://www.sanfoundry.com/1000-python-questions-answers/ 23/24
11/10/21, 9:03 PM 1000 Python MCQ (Multiple Choice Questions) - Sanfoundry
Name*
Email*
Subscribe
https://www.sanfoundry.com/1000-python-questions-answers/ 24/24