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. Python has a built-in package called?

reg
regex
re
regx

2. Can one block of except statements handle multiple exception?

yes, like except TypeError, SyntaxError [,…]
yes, like except [TypeError, SyntaxError]
No
None of the above

3. What will be output for the folllowing code?

try:
  f = open(""demofile.txt"")
  f.write(""Lorum Ipsum"")
except:
  print(""Something went wrong when writing to the file"")
finally:
  f.close()

demofile.txt
Lorum Ipsum
Garbage value
Something went wrong when writing to the file

4. Which of this statment will give an error?

a++
++a
a+=1
Both A and B

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

if False:
print ("inside if block")
elif True:
print ("inside elif block")
else:
print ("inside else block")

inside if block
inside elif block
inside else block
Error

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

str1="poWer"
str1.upper()
print(str1)

POWER
Power
power
poWer

7. Which of the following items are present in the function header?

function name
parameter list
return value
Both A and B

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

9. Which of the following sequences would be generated bt the given line of code?

range (5, 0, -2)

5 4 3 2 1 0 -1
5 4 3 2 1 0
5 3 1
None of the above

10. . Which among the following are mutable objects in Python?
(i) List
(ii) Integer
(iii) String
(iv) Tuple

i only
i and ii only
iii and iv only
iv only

Results