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 result after the execution of above Python code?

list1=[3,2,5,7,3,6]
list1.pop(3)
print(list1)

[3,2,5,3,6]
[2,5,7,3,6]
[2,5,7,6]
[3,2,5,7,3,6]

2. What will following Python code return?

str1="Stack of books"
print(len(str1))

13
14
15
16

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

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. Which of the following is not valid variable name in Python?

_var
var_name
var11
11var

7. Which of the following Python code will give different output from the others?

for i in range(0,5):
    print(i)
for j in [0,1,2,3,4]:
    print(j)
for k in [0,1,2,3,4,5]:
    print(k)
for l in range(0,5,1):
    print(l)

8. In Regex, [a-n] stands for?

Returns a match for any digit between 0 and 9
Returns a match for any lower case character, alphabetically between a and n
Returns a match for any two-digit numbers from 00 and 59
Returns a match for any character EXCEPT a, r, and n

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

list1=[1,3,4,2]
x=list1.pop(2)
print(set([x]))

{1,3,4}
{1,3,2}
{2}
{4}

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

package
module
directory
None of the above

Results