Python Programming Quiz


Play this Python quiz that will help you to excel in C++ certification exams, placements etc. This Python programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This Python programming test enables you to assess your knowledge of Python programming.

Take the Free Practice Test



Python MCQs

Practice Python MCQ Questions, which will help you to understand Python programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

Python Quiz

Try Free Python Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

Python Quiz

1. What will be the output of following Python code?

list1=["Python","Java","c","C","C++"]
print(min(list1))

c
C++
C
min function cannot be used on string elements

2. Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?

A.__init__(self)
B.__init__(self)
A.__init__(B)
B.__init__(A)

3. Which of the following options will give an error if set1={2,3,4,5}?

print(set1[0])
set1[0]=9
set1=set1+{7}
All of the above

4. Suppose there are two sets, set1 and set2,where set1 is the superset of set2. It is required to get only the unique elements of both the sets. Which of the following will serve the purpose?

set1={2,3}
set2={3,2}
set3={2,1}
if(set1==set2):
print("yes")
else:
print("no")
if(set1==set3):
print("yes")
else:
print("no")

set1|set2
set1&set2
set1-set2
None of the above

5. What will be the output of following Python code snippet?

for i in range(0 , -2 , -1):
print(i)

0, -1
0, -1, -1
-1, -2
Error

6. When a child class inherits from only one parent class, it is called?

single inheritance
singular inheritance
Multiple inheritance
Multilevel inheritance

7. A variable that is defined inside a method and belongs only to the current instance of a class is known as?

Inheritance 
Instance variable
Function overloading
Instantiation 

8. What will be output of this expression:

'p' + 'q' if '12'.isdigit() else 'r' + 's'

pq
rs
pqrs
pq12

9. ___________ are the arguments passed to a function in correct positional order.

Required arguments
Keyword arguments
Default arguments
Variable-length arguments

10. What will be the output of below Python code?

class A:
def __init__(self,num):
num=3
self.num=num
def change(self):
self.num=7
a=A(5)
print(a.num)
a.change()
print(a.num)

5
     7
5
     5
3
     3
3
     7

Results