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. Which of the following will give error?

Suppose dict1={"a":1,"b":2,"c":3}

print(len(dict1))
print(dict1.get("b"))
dict1["a"]=5
None of these.

2. Which operator is used in Python to import modules from packages?

.
*
->
&

3. All keyword in python are in

Lowercase
Uppercase
Both uppercase & Lowercase
None of the above

4. Which of the following is correct?

class A:
def __init__(self):
self.count=5
self.count=count+1
a=A()
print(a.count)

5
6
0
Error

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

str1="learn python"
str2=""
str3=""
for x in str1:
if(x=="r" or x=="n" or x=="p"):
str2+=x
pass
if(x=="r" or x=="e" or x=="a"):
str3+=x
print(str2,end=" ")
print(str3)

rnpn ea
rnpn ear
rnp ea
rnp ear

6. Which of the following is False regarding loops in Python?

Loops are used to perform certain tasks repeatedly.
While loop is used when multiple statements are to executed repeatedly until the given condition becomes False
While loop is used when multiple statements are to executed repeatedly until the given condition becomes True.
for loop can be used to iterate through the elements of lists.

7. Which function returns a list containing all matches?

findall
search
split
find

8. What will be the result of following Python code snippet after execution?

str1=""
i=0
var2=1
while(i<3):
var1=1
if str1:
var2=var1*var2+5
else:
var2=var1*var2+1
i=i+1
print(var2)

16
12
11
4

9. What will be the output of the following program on execution?

a=0
b=6
x=(a&b)|(a&a | a&b)
y=not(x)
print(y)

6
True
0
False

10. _____ represents an entity in the real world with its identity and behaviour.

A method
An object
A class
An operator

Results