Amrit Mahotsav

Python MCQ

Python MCQ||Python Revision Tour||Basic Python MCQ

The greatest Python MCQ Questions are provided below, and they will test your basic knowledge of Python programming. This Python MCQ Online Test contains 20 of the most important basic Multiple Choice Questions. 

These Python MCQs are quite popular and are frequently asked in Python exams and interviews. Finally, to check your final preparation, you must select the correct option for each question. Aside from that, you may get the Python MCQ PDF for free by clicking the link below.

1. Who developed Python Programming Language?
a) Wick van Rossum
b) Rasmus Lerdorf
c) Guido van Rossum
d) Niene Stom


2. Which type of Programming does Python support?
a) object-oriented programming
b) structured programming
c) functional programming
d) all of the mentioned


3. Is Python case sensitive when dealing with identifiers?
a) no
b) yes
c) machine-dependent
d) None of the mentioned


4. Which of the following is the correct extension of the Python file?
a) .python
b) .pl
c) .py
d) .p


5. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted


6. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned


7. What will be the value of the following Python expression?
4 + 3 % 5
a) 7
b) 2
c) 4
d) 1


8. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned


9. Which keyword is used for function in Python language?
a) Function
b) Def
c) Fun
d) Define


10. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*


11. Which of the following functions can help us to find the version of python that we are currently working on?
a) sys.version(1)
b) sys.version(0)
c) sys.version()
d) sys.version
12. Python supports the creation of anonymous functions at runtime, using a construct called __________
a) pi
b) anonymous
c) lambda
d) none of the mentioned


13. What is the order of precedence in python?
a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction


14. What will be the output of the following Python code snippet if x=1?
x<<2
a) 4
b) 2
c) 1
d) 8


15. What does pip stand for python?
a) unlimited length
b) all private members must have leading and trailing underscores
c) Preferred Installer Program
d) None of the mentioned

16. Which of the following is true for variable names in Python?
a) underscore and ampersand are the only two special characters allowed
b) unlimited length
c) all private members must have leading and trailing underscores
d) none of the mentioned


17. Which of the following is the truncation division operator in Python?
a) |
b) //
c) /
d) %


18. Which of the following functions is a built-in function in python?
a) factorial()
b) print()
c) seed()
d) sqrt()


19. Which of the following is the use of id() function in python?
a) Every object doesn’t have a unique id
b) Id returns the identity of the object
c) All of the mentioned
d) None of the mentioned


20. The following python program can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print(“Sanfoundry”)
return x(*args, **kwargs)

return f1
a) any number of
b) 0
c) 1
d) 2


21. What will be the output of the following Python function?
min(max(false,-3,-4),2,7)
a) -4
b) -3
c) 2
d) False


22. Which of the following is not a core data type in Python programming?
a) Tuples
b) Lists
c) Class
d) Dictionary


23. What will be the output of the following Python expression if x=56.236?
print(“%.2f”%x)
a) 56.236
b) 56.23
c) 56.0000
d) 56.24