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 is used to define a block of code in Python?

Parenthesis
Indentation
Curly braces
None of the above

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

def function1(var1,var2=5):
    var1=2
    var3=var1*var2
    return var3
var1=3
print(function1(var1,var2))

10
15
Error as var2 is not defined while calling the function
Does not give any error as var2 is a default argument

3. Function blocks begin with the keyword?

define
fun
function
def

4. Which one of the following is the correct way of calling a function?

function_name()
call function_name()
ret function_name()
function function_name()

5. Which of the following is not used as loop in Python?

for loop
while loop
do-while loop
None of the above

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

switch
foreach
nested
forall

7. What will be the output of statment 2**2**2**2

16
256
32768
65536

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

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

a=0
b=5
x=(a&b)|(a&a)|(a|b)
print("x")

1
5
0
None of the above

Results