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 is a python file with .py extension called?

package
module
directory
None of the above

2. What will the below Python code do?

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")

Yes, No
No, No
Yes, Yes
"==" is not supported for set in Python

3. Which of the following statements is true?

Python is a high level programming language.
Python is an interpreted language.
Python is an object-oriented language
All of the above

4. What will be the following Python code?

dict1={"a":10,"b":2,"c":3}
str1=""
for i in dict1:
    str1=str1+str(dict1[i])+" "
    str2=str1[:-1]
print(str2[::-1])

3, 2
3, 2, 10
3, 2, 01
Error

5. Operators with the same precedence are evaluated from?

Left to Right
Right to Left
Depends on Compiler
None of the above

6. What will be the output of above Python code?

d1={"abc":5,"def":6,"ghi":7}
print(d1[0])

abc
5
{"abc":5}
Error

7. What will be the values of var1 and var2 after the execution of program?

var=3
var1=0
var2=var1+1
while(var<7):
var2=var2+var1
if(var1%2==0):
var=var+1
var1=var1+1
else:
var2=var2*var1
var1=var1+3

12,648
13,648
13,660
9,72

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

a=0
b=1
if (a and b):
print("hi")
elif(not(a)):
print("hello")
elif(b):
print("hi world")
else:
print("hello world")

hello world
hi
hi world
hello

9. What will be the output of the following code?

x = "abcd"
for i in range(len(x)):
print(i)

abcd
0 1 2 3
1 2 3 4
a b c d

10. Which of the following is not a relational opeartor in Python?

>=
<=
=
!=

Results