Top 20 Python practice MCQ’s with Answers
Python is one of the most popular programming languages used by developers today.
It is easy to learn, versatile, and can be used for a wide range of applications. However, mastering Python requires a lot of practice, and one of the best ways to do that is by taking multiple-choice questions (MCQs).
In this blog post, we have compiled a list of the top 20 Python practice MCQs with answers to help you test your knowledge and improve your Python skills.
Question 1 : In Python, print () by default adds which of the following as an end line argument?
Answers : b. \n
Question 2 : Which of the following is not true about variable names?
a. The length of the variable name is fixed
b. Can contain upper case or lowercase letters and digits 0-9
c. Variable names cannot begin with a digit
d. Variable names are case sensitive
Answers : a. The length of the variable name is fixed
Question 3 : What does IDE stand for?
a. Internet Data Evaluation
b. Integrated Drive Electronics
c. Integrated Development Enterprises
d. Integrated Development Environment
Answers : d. Integrated Development Environment
Question 4 : In Spyder, the command to clear the console is
Answers : d. %clear
Question 5 : Which of the following code cannot be used to initialize multiple variables with a common value?
b. a, b, c = 55, 55, 55
d. a = 55; b = a; c = b
Answers : a. a, b, c = 55
Question 6 : What will be the output after executing the following codes?
Answers : c. 3
Question 7 : Which of the following is true with respect to the below codes?
a = 4**3
b = pow(4,3)
a. a = b
b. a ≠ b
c. a < b
d. a > b
Answers : a. a = b
Question 8 : What will be the output after executing the following codes?
x = 8
if x > 8:
Answers : c. 10
Question 9 :Which of the following conversion results in an error?
Answers : a.
Question 10 :Which of the following command is used to print the output 01-Jan-2020 ?
a. print(’01’,’Jan’, sep=’ ‘, end=’-2020′)
b. print(’01’,’Jan’, sep=’-‘, end=’-2020′)
c. print(’01’,’Jan’, sep=’-‘, end=’2020’)
d. print(’01’,’Jan’,’2020′, sep=’-‘, end=’-2020\n’)
Answers : b. print('01','Jan', sep='-', end='-2020')
Question 11 :For which type of error does the interpreter runs the program and does not report an error?
a. Semantic error
b. Syntax error
d. Key error
Answers : a. Semantic error
Question 12 : What will be the output after executing the following codes?
x = 27
y = 4
Answers : d. 6
Question 13 : Identify which of the following is not a valid variable name?
a. X005 =10
b. A.2 = 10
c. N_s = 10
d. r10 = 10
Answers : b. A.2 = 10
Question 14 :
a. Displays the current Python version
b. Displays the operating system version
c. Displays the location of the Python interpreter
d. All of the above
Answers : a. Displays the current Python version
Question 15 : The operators ‘is’ & ‘is not’ are?
a. Comparison Operators
c. Membership Operators
d. Relational Operators
Answers : b.
Question 16 :
Answers : c. 5
Question 17 : What would be the datatype of variable ‘c’ after executing the following code?
a = 5
b = 6
c = print(a/b)
Answers : b. Nonetype
Question 18 : Which is not a valid assignment operator?
Answers : d. %%=
Question 19 : Which is not a valid bitwise operator?
Answers : d. ≤
Question 20: The datatype of the variable a = (1i) is
Answers : c. SyntaxError