StackTipsStackTips
Pythonbeginner

Advanced Python Quiz to Test Your Knowledge

Here is an advanced quiz on Python covering various topics for practice. It contains 50 MCQs with both theoretical and coding questions.

50 questions30 min

The test contains 50 questions and has a time imit of 30 minutes

The test is not official, it's just a nice way to see how much you know, or don't know, about Python.

0/50 checked
  1. 01

    What is the term to describe this code?

    count, fruit, price = (2, 'apple', 3.5)
  2. 02

    What built-in list method would you use to remove items from a list?

  3. 03

    What is one of the most common use of Python's sys library?

  4. 04

    What is the runtime of accessing a value in a dictionary by using its key?

  5. 05

    What is the correct syntax for defining a class called Game, if it inherits from a parent class called LogicGame?

  6. 06

    What built-in Python data type is commonly used to represent a stack?

  7. 07

    What is the purpose of the "self" keyword when defining or calling instance methods?

  8. 08

    Which of these is NOT a characteristic of namedtuples?

  9. 09

    What is an instance method?

  10. 10

    Which statement does NOT describe the object-oriented programming concept of encapsulation?

  11. 11

    What is the purpose of an if/else statement?

  12. 12

    What built-in Python data type is best suited for implementing a queue?

  13. 13

    What is the correct syntax for instantiating a new object of the type Game?

  14. 14

    What does the built-in map() function do?

  15. 15

    If you don't explicitly return a value from a function, what happens?

  16. 16

    What is the purpose of the pass statement in Python?

  17. 17

    What is the term used to describe items that may be passed into a function?

  18. 18

    Which collection type is used to associate values with unique keys?

  19. 19

    When does a for loop stop iterating?

  20. 20

    Assuming the node is in a singly linked list, what is the runtime complexity of searching for a specific node within a singly linked list?

  21. 21

    What happens when you use the built-in function all() on a list?

  22. 22

    What is the algorithmic paradigm of quick sort?

  23. 23

    What is runtime complexity of the list's built-in .append() method?

  24. 24

    What is key difference between a set and a list?

  25. 25

    What is the definition of abstraction as applied to object-oriented Python?

  26. 26

    Suppose a Game class inherits from two parent classes: BoardGame and LogicGame. Which statement is true about the methods of an object instantiated from the Game class?

  27. 27

    What does calling namedtuple on a collection type return?

  28. 28

    What symbol(s) do you use to assess equality between two elements?

  29. 29

    What does a class's __init__() method do?

  30. 30

    What is meant by the phrase "space complexity"?

  31. 31

    What is the correct syntax for creating a variable that is bound to a dictionary?

  32. 32

    What is the purpose of the self keyword when defining or calling methods on an instance of an object?

  33. 33

    What statement about the class methods is true?

  34. 34

    What does it mean for a function to have linear runtime?

  35. 35

    According to the PEP 8 coding style guidelines, how should constant values be named in Python?

  36. 36

    Describe the functionality of a deque.

  37. 37

    Why is it considered good practice to open a file from within a Python script by using the with keyword?

  38. 38

    Why would you use a virtual environment?

  39. 39

    What is a lambda function ?

  40. 40

    What is the primary difference between lists and tuples?

  41. 41

    What does the // operator in Python 3 allow you to do?

  42. 42

    What file is imported to use dates in python?

  43. 43

    Elements surrounded by [] are _, {} are _, and () are ___.

    Select all that apply

  44. 44

    When would you use a try/except block in code?

  45. 45

    it is often the case that the pandas library is used for _ data and NumPy for _ data.

  46. 46

    What do you need to do to install additional packages into Python?

  47. 47

    Suppose you need to use the sin function from the math library. What is the correct syntax for importing only that function?

  48. 48

    What do you get if you apply numpy.sum() to a list that contains only Boolean values?

  49. 49

    What is the correct syntax for defining an init() method that takes no parameters?

  50. 50

    Which choice is not a native numerical type in Python?