Python Quiz

Answer 10 questions and see how you score!

1. Which is the correct way to open a file for reading and writing?

2. Which method returns a view object of a dictionary’s keys?

3. Which function converts bytes to string?

4. Which function converts a number to binary?

5. What is the output of: {i:i%2==0 for i in range(3)}?

6. Which function formats a string with placeholders?

7. Which of these is used to define an abstract base class?

8. What is the result of bool([])?

9. What does the @staticmethod decorator do?

10. Which of the following creates a set?