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 of above Python code?

dict={"Joey":1,"Rachel":2}
dict.update({"Phoebe":2})
print(dict)

{"Joey":1,"Rachel":2,"Phoebe":2}
{"Joey":1,"Rachel":2}
{"Joey":1,"Phoebe":2}
Error

2. Which of the following is True regarding loops in Python?

Loops should be ended with keyword "end".
No loop can be used to iterate through the elements of strings.
Keyword "break" can be used to bring control out of the current loop.
Keyword "continue" is used to continue with the remaining statements inside the loop.

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

str1="Information"
print(str1[2:8])

format
formatio
orma
ormat

4. Parent class is the class being inherited from, also called?

derived class
Child class
Hybrid class
base class

5. How many times will the loop run?

i=2
while(i>0):
i=i-1

2
3
1
0

6. Can we write if/else into one line in python?

Yes
No
if/else not used in python
None of the above

7. What will be output for the folllowing code?

x = ""hello""

if not type(x) is int:
  raise TypeError(""Only integers are allowed"")

hello
garbage value
Only integers are allowed
Error

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

list1=[8,0,9,5]
print(list1[::-1])

[5,9,0,8]
[8,0,9]
[8,0,9,5]
[0,9,5]

9. What is the extension of python file?

.p
.py
.python
None of the above

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

def function1(var1=5, var2=7):
    var2=9
    var1=3
    print (var1, " ", var2)
function1(10,12)

5 7
3 9
10 12
Error

Results