Python Intermediate
This test evaluates your intermediate knowledge of Python, including modules, OOP concepts, exception handling, and file operations. Enhance your understanding with Intermediate Python Projects by Real Python, Python Classes and Objects (Official Docs), and this practical Intermediate Python Tutorial on YouTube.
1
What is the output of [x**2 for x in range(5)]?
2
Which decorator is used to define a class method?
3
What does the __name__ variable contain when a module is run directly?
4
Which of these is NOT a built-in Python exception?
5
What is the purpose of the __init__.py file?
6
Which method is called when an object is deleted?
7
What is the output of 'hello'.upper()?
8
Which of these data types is immutable?
9
How do you open a file in read and write mode?
10
What does the super() function do?
11
Which module is used for working with dates?
12
What is the output of bool(0)?
13
Which method is used to sort a list in-place?
14
What is the correct way to create a virtual environment?
15
Which operator is used for exponentiation?
16
What does the join() method do?
17
Which of these is a correct dictionary comprehension?