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 would give an error?

list1=[]
list1=[]*3
list1=[2,8,7]
None of the above

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

class A():
def __init__(self,count=100):
self.count=count

obj1=A()
obj2=A(102)
print(obj1.count)
print(obj2.count)

100
    100
100
    102
102
    102
Error

3. Which one of the following is correct way of declaring and initialising a variable, x with value 5?

int x
     x=5
int x=5
x=5
declare x=5

4. Which of the following is a valid variable?

var@
32var
class
abc_a_c

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

list1=[1,3,5,2,4,6,2]
list1.remove(2)
print(sum(list1))

18
19
21
22

6. Python programming language allows to use one loop inside another loop known as?

switch
foreach
nested
forall

7. Which of the following will give output as [23,2,9,75] ?

If list1=[6,23,3,2,0,9,8,75]

print(list1[1:7:2])
print(list1[0:7:2])
print(list1[1:8:2])
print(list1[0:8:2])

8. Which of the following two Python codes will give same output?
(i) print(tupl[:-1])
(ii) print(tupl[0:5])
(iii) print(tupl[0:4])
(iv) print(tupl[-4:])

If tupl=(5,3,1,9,0) 

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

9. Python has a built-in package called?

reg
regex
re
regx

10. In Regex, s stands for?

Returns a match where the string DOES NOT contain digits
Returns a match where the string DOES NOT contain a white space character
Returns a match where the string contains a white space character
Returns a match if the specified characters are at the end of the string

Results