🐍 Python Mini Mock Test

Day 21 Challenge - Test Your Python Programming Knowledge

Duration: 15 Minutes
15:00
Questions: 10

🎯 Ready to Test Your Python Skills?

This mock test covers various Python topics including:

📝 Basic Syntax
Variables, data types, operators
🔄 Control Structures
Loops, conditions, functions
📊 Data Structures
Lists, dictionaries, sets
⚡ Advanced Concepts
OOP, modules, error handling

Click "Start Test" when you're ready!

Question 1/10
Easy
What will be the output of the following Python code?
x = 5 y = 2 print(x // y, x % y)
A
2.5 1
B
2 1
C
2.5 0
D
3 1
Question 2/10
Easy
Which of the following is the correct way to create a list in Python?
A
list = {1, 2, 3}
B
list = [1, 2, 3]
C
list = (1, 2, 3)
D
list = "1, 2, 3"
Question 3/10
Medium
What will be the output of this code?
def func(a, b=2, c=3): return a + b + c print(func(1, c=5))
A
6
B
8
C
9
D
Error
Question 4/10
Easy
Which method is used to add an element to the end of a list in Python?
A
add()
B
append()
C
insert()
D
extend()
Question 5/10
Medium
What will be the output of this list comprehension?
result = [x**2 for x in range(5) if x % 2 == 0] print(result)
A
[0, 1, 4, 9, 16]
B
[0, 4, 16]
C
[1, 9]
D
[0, 2, 4]
Question 6/10
Easy
Which of the following is used to handle exceptions in Python?
A
try-catch
B
try-except
C
try-error
D
handle-exception
Question 7/10
Hard
What will be the output of this code?
class Counter: def __init__(self): self.count = 0 def __call__(self): self.count += 1 return self.count c = Counter() print(c(), c(), c())
A
1 1 1
B
1 2 3
C
0 1 2
D
Error
Question 8/10
Medium
What is the difference between a tuple and a list in Python?
A
Tuples are mutable, lists are immutable
B
Tuples are immutable, lists are mutable
C
No difference
D
Tuples use [], lists use ()
Question 9/10
Medium
What will be the output of this dictionary operation?
d = {'a': 1, 'b': 2} print(d.get('c', 'not found'))
A
None
B
'not found'
C
KeyError
D
0
Question 10/10
Hard
What will be printed by this code involving decorators?
def decorator(func): def wrapper(): print("Before") func() print("After") return wrapper @decorator def say_hello(): print("Hello") say_hello()
A
Hello
B
Before
Hello
After
C
Before
After
D
Error

🎉 Test Completed!

0/10

Great job!

0
Correct Answers
0
Incorrect Answers
0%
Score Percentage