LogIn
I don't have account.

Practice python Quizzes

Sharpen your technical edge with advanced python quizzes built for serious learners and professionals. These quizzes challenge your reasoning, improve retention and provide hands-on practice similar to real engineering scenarios. Perfect for upskilling and interview preparation.

Explore All python Quizzes

Learn python step by step with interactive quizzes designed for beginners and learners revising key concepts. Build a strong foundation with clear, structured practice in python.
Question 1
What will be the output of the following code? python Copy Edit
print(type(5 / 2))
1
<class 'double'>
2
<class 'float'>
3
<class 'int'>
4
<class 'long'>
Question 2
What will be the output of the following code? python Copy Edit
a = [1, 2, 3, 4]
print(a[-1])
1
2
2
1
3
3
4
4
Question 3
What will be the output of the following code? python Copy Edit
print(bool([]), bool(0), bool(''))
1
True True True
2
True False False
3
False True False
4
False False False
Question 4
Which method is used to remove the last element from a list?
1
discard()
2
pop()
3
remove()
4
delete()
Question 5
What will be the output of the following code?
a = [1, 2, 3]
b = a
b.append(4)
print(a)
1
[1, 2, 3, 4]
2
[1, 2, 3]
3
[4, 1, 2, 3]
4
Error
Question 6
Which of the following statements is true for Python?
1
Python is an interpreted language.
2
Python is both compiled and interpreted.
3
Python is neither compiled nor interpreted.
4
Python is a compiled language.
Question 7
What will be the output of the following code?
def foo(x, y=[]):
    y.append(x)
    return y
print(foo(1))
print(foo(2))
1
[1] [2]
2
[1] [1, 2]
3
[1, 2] [1, 2]
4
[2] [2]
Question 8
What will be the output of the following code?
class A:
    def __init__(self):
        self.var = 10
class B(A):
    def __init__(self):
        super().__init__()
        self.var = 20
obj = B()
print(obj.var)
1
20
2
Error
3
None
4
10
Question 9
What will be the output of the following code?
class A:
    def __init__(self):
        self.var = 10
class B(A):
    def __init__(self):
        self.var = 20
        super().__init__()
obj = B()
print(obj.var)
1
None
2
Error
3
20
4
10
Question 10
What will be the output of the following code?
x = (i**2 for i in range(3))
print(list(x))
print(list(x))
1
[0, 1, 4] [0, 1, 4]
2
Error
3
[0, 1, 4] [0, 1, 4, 9]
4
[0, 1, 4] []
Question 11
What will be the output of the following code?
stack = []
stack.append(1)
stack.append(2)
stack.append(3)
print(stack.pop(), stack.pop())
1
1 2
2
2 3
3
1 3
4
3 2
Question 12
Which concept allows abstraction in Python?
1
The staticmethod decorator
2
The @abstractmethod decorator
3
The @override decorator
4
The lambda function
Question 13
In Python, which function is used to get the ASCII value of a character?
1
asc()
2
chr()
3
ord()
4
ascii()
Question 14
What will be the output of the following Python code?
print(chr(66))
1
66
2
b
3
A
4
B
Question 15
What will be the output of the following Python code?
print(ord('z') - ord('a'))
1
25
2
26
3
-25
4
24
Question 16
In Python, which function converts an integer ASCII value to its corresponding character?
1
ord()
2
chr()
3
asc()
4
convert()
Question 17
What will be the output of 'A' + 1 in Python?
1
A1
2
TypeError
3
B
4
66
Question 18
In Python, which data structure is equivalent to a HashMap
1
Tuple
2
List
3
Set
4
Dictionary (dict)
Question 19
In Python, which data type is used for large integers beyond the typical integer range?
1
long
2
bigInt
3
int
4
float
Question 20
What is the output of the following Python code?
s = "Python"
s[0] = 'p'
print(s)
1
python
2
ython
3
Error
4
Python
Question 21
What will be the output of this code snippet?
text = "abracadabra"
print(text.find('a'), text.rfind('a'))
1
10 0
2
0 0
3
0 10
4
1 10
Question 22
Which method would you use to convert the first character of each word in a string to uppercase and the rest to lowercase?
1
title()
2
capitalize()
3
lower()
4
upper()
Question 23
What is the output of the following code?
s = "Hello\nWorld"
print(r"{}".format(s))
1
Error
2
Hello\nWorld (literally)
3
Hello  
World
4
Hello\nWorld
Question 24
What will be the output of this snippet?
s = "abc" * 3
print(s)
1
Error
2
abc abc abc
3
abcabcabc
4
abc3
Question 25
Which Python library can be used to visualize search algorithms applied to a problem?
1
TensorFlow
2
Scikit-learn
3
Pandas
4
matplotlib
Question 26
In a doubly linked list containing nodes A ↔ B ↔ C ↔ D ↔ E ↔ F, if a pointer p points to node E, then what does p.previous.next refer to?
1
A
2
D
3
F
4
E