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 given Python code?

n=7
c=0
while(n):
if(n>5):
c=c+n-1
n=n-1
else:
break
print(n)
print(c)

5 11
5 9
7 11
5 2

2. Which one is false regarding local variables?

These can be accessed only inside owning function
Any changes made to local variables does not reflect outside the function.
These remain in memory till the program ends
None of the above

3. What type of data is: arr = [(1,1),(2,2),(3,3)]?

Array of tuples
Tuples of lists
List of tuples
Invalid type

4. Which statement will check if a is equal to b?

if a = b:
if a == b:
if a === c:
if a == b

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

tupl=()
tupl1=tupl*2
print(len(tupl1))

0
2
1
Error as tuple object has no attribute to len

6. Which of the following Python codes will give same output if
(i) dict.pop("book")
(ii) del dict["book"]
(iii) dict.update({"diary":1,"novel":5})

dict={"diary":1,"book":3,"novel":5}

i, ii, iii
i, ii
i, iii
ii, iii

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

8. By the use of which character, single line is made comment in Python?

*
@
#
!

9. What will be the value of variable y after execution of following Python code?

x="55"
y=x + str(9)

64
9
559
Error

10. A return statement with _____ arguments.

No
1
2
Any

Results