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 is correct with respect to above Python code?

d={"a":3,"b":7}

a dictionary d is created.
a and b are the keys of dictionary d.
3 and 7 are the values of dictionary d
All of the above.

2. Python is written in which language?

C
C++
Java
None of the above

3. What is a python file with .py extension called?

package
module
directory
None of the above

4. How many except statements can a try-except block have?

0
1
more than one
more than zero

5. Lambda is a function in python?

True
False
Lambda is a function in python but user can not use it.
None of the above

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

str1="hello"
c=0
for x in str1:
   if(x!="l"):
       c=c+1
   else:
       pass
print(c)

2
0
4
3

7. 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

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

tupl=("annie","hena","sid")
print(tupl[-3:0])

("annie")
()
None
Error as slicing is not possible in tuple.

9. Which of the following will print the pi value defined in math module?

print(pi)
print(math.pi)
from math import pi
print(pi)
from math import pi
print(math.pi)

10. 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.

Results