
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
- Python Useful Resources
- Python - Questions and Answers
- Python - Quick Guide
- Python - Tools/Utilities
- Python - Useful Resources
- Python - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Python. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - What is output for −
a = ['he', 'she', 'we']
' '.join(a)
Answer : B
Explanation
The method join() takes list of string as input and returns string as output. It removes ', ' and add the given string with join to the list.
Answer : A
Explanation
z = z++ is not valid in python, it is not a legal expression. It results in syntax error.
Q 3 - Select the option for following code −
s = 0 for d in range(0, 5, 0.1): … s += d … print(s)
Answer : D
Explanation
we will get type error during runtime as float object cannot be interpreted as integer. Here 0.1 is the float value.
Q 4 - Suppose we have a set a = {10,9,8,7}, and we execute a.remove(14) what will happen ?
A - We cannot remove an element from set.
Answer : C
Explanation
since there is no such element in the set, so key error is raised.
Q 5 - Find the output of the code?
def f(a, b = 1, c = 2): print('a is: ',a, 'b is: ', b, 'c is: ', c) f(2, c = 2) f(c = 100, a = 110)
a is: 110 b is: 1 c is: 100
a is: 110 b is: 2 c is: 100
a is: 110 b is: 0 c is: 100
D - a is: 110 b is: 0 c is: 100
a is: 110 b is: 0 c is: 100
Answer : A
Explanation
Value of Arguments is passed to the parameters in order of their sequence.
Q 6 - What is the output of the following code?
class P: def __init__(self): self.__x=100 self.y=200 def print(self): print(self.__x, self.y) class C(P): def __init__(self): super().__init__() self.__x=300 self.y=400 d = C() d.print()
Answer : B
Explanation
In the above code x is a private variable declared in the class P. Thus value of x cannot be changed in the class C which inherits class P. But y is not a private variable thus its value can be changed.
Q 7 - Which of the function among will return 4 on the set s = {3, 4, 1, 2}?
Answer : B & C.
Explanation
len(s) returns the length of the set and max(s) returns the maximum value in the set.
Q 8 - Which event among them is fired when the right mouse button is released?
Answer : C
Explanation
It is the default way to do this kind of work.
Q 9 - Select the code for the following output?

A - Canvas.showinfo(''showinfo'', ''Programming'')
B - Tkinter.showinfo(''showinfo'' , ''Programming'')
C - Tkinter.messagebox.showinfo(''Programming'')
D - Tkinter.messagebox.showinfo(''showinfo'' , ''Programming'')
Answer : D
Q 10 - Select the code for the following output?

A - Turtle.circle(20 , ''green '')