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 options will not result in an error when performed on tuples in Python where tupl=(5,2,7,0,3)?

tupl[1]=2
tupl.append(2)
tupl1=tupl+tupl
tupl.sort()

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

def function1(var1):
    var1=var1+10
    print (var1)
var1=12
function1(var1)
print(var1)

22
     22
12
     12
22
     22
12
     22

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

4. Which one of the following is mutable data type?

set
int
str
tupl

5. How many local and global variables are there in the following Python code?

var1=5
def fn():
var1=2
var2=var1+5
var1=10
fn()

1 local, 1 global variables
1 local, 2 global variables
2 local, 1 global variables
2 local, 2 global variables

6. Which one of the following is immutable data type?

list
set
int
dict

7. If str1="Programming Language"
What does str1.find("m") return?

Number of occurances of "m" in string str1.
Index positions of "m" in the string str1.
It returns the whole string str1 if it contains "m".
It returns the index position of first occurance of "m" in the string str1.

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

9. Which of the following is incorrect regarding variables in Python?

Variable names in Python cannot start with number. However, it can contain number in any other position of variable name.
Variable names can start with an underscore.
Data type of variable names should not be declared
None of the above

10. What will be output of this expression:

'p' + 'q' if '12'.isdigit() else 'r' + 's'

pq
rs
pqrs
pq12

Results