Exercises

Object-Oriented Programming in Python

Assess your understanding of object-oriented programming (OOP) in Python. This quiz covers creating classes and instances, core OOP principles, encapsulation, inheritance, subclasses and base classes, and Python special methods such as __init__ and __del__. You will also test your knowledge of using isinstance() and identifying a class's base classes with built-in attributes. Ideal for beginners learning Python classes or anyone reviewing essential OOP concepts.

Answer the questions below and check the explanation for each answer.

0/10 answered

  1. 1

    What keyword is used to create a new class in Python?

  2. 2

    Which of the following is NOT a principle of Object-Oriented Programming?

  3. 3

    What is the term used for hiding the internal representation of an object to protect the integrity of an object?

  4. 4

    Which method is called when an object is created?

  5. 5

    How do you create a new instance of a class named 'Car'?

  6. 6

    If class 'B' is derived from class 'A', which class is the subclass?

  7. 7

    Which special method is called when an object is deleted?

  8. 8

    What is the correct way to check if 'myobj' is an instance of class 'MyClass'?

  9. 9

    Which attribute contains the base classes of a class in a tuple form?

  10. 10

    What is the process of deriving a new class from a base class called?

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate