1
python-logo

Python quiz – Intermediate

Test your Pythonic knowledge with our intermediate-level Python quiz!

1 / 20

What is the output of del() function?

2 / 20

What is the output of the following code? print(5 > 4 and 10 > 9)

3 / 20

Which of the following is the correct way to import a module in Python?

4 / 20

What is the output of the following code? list1 = [1, 2, 3] list2 = [4, 5, 6] print(list1 + list2)

5 / 20

Which of the following is a valid keyword argument for the print() function?

6 / 20

What is the output of the following code? print(len((‘Hello’,’World’)))

7 / 20

What is the output of the following code? print(‘Python'[1:4])

8 / 20

What type of data is returned by the split() method?

9 / 20

Which of the following is a valid dictionary comprehension?

10 / 20

What is the correct way to open a file in read-only mode?

11 / 20

What is the output of print(2 ** 3)

12 / 20

What is the output of print([‘Hello’] * 5)?

13 / 20

Which of the following can be used as a key in a Python dictionary?

14 / 20

What type of loop allows a program to execute a set of instructions an unknown number of times?

15 / 20

What is the correct way to declare a global variable inside a function?

16 / 20

What is the output of print(2 == 2.0)?

17 / 20

Which of the following is incorrect syntax for a function definition?

18 / 20

What is the output of print(type(None))?

19 / 20

Which of the following is used to handle exceptions in Python?

20 / 20

What is the output of the following code? print(‘Hello’ * 5)